Revision: 1520 Author: jasonpmorrison Date: 2006-07-18 22:42:24 -0700 (Tue, 18 Jul 2006) ViewCVS: http://svn.sourceforge.net/rubyeclipse/?rev=1520&view=rev Log Message: ----------- IOccurrencesFinder and implementors updated to return List<Position> Modified Paths: -------------- branches/type_inferrence/trunk/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/ti/MarkOccurrencesTest.java Modified: branches/type_inferrence/trunk/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/ti/MarkOccurrencesTest.java =================================================================== --- branches/type_inferrence/trunk/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/ti/MarkOccurrencesTest.java 2006-07-19 05:42:12 UTC (rev 1519) +++ branches/type_inferrence/trunk/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/ti/MarkOccurrencesTest.java 2006-07-19 05:42:24 UTC (rev 1520) @@ -8,6 +8,7 @@ import org.rubypeople.rdt.internal.ti.util.OffsetNodeLocator; import junit.framework.TestCase; +import org.eclipse.jface.text.Position; /** * Tests related to matching occurrences. @@ -21,21 +22,19 @@ public void setUp() { occurrencesFinder = new DefaultOccurrencesFinder(); } - - private Node parse(String source) { - return new RubyParser().parse(source); - } - private void assertOccurrencesEqual( String source, int offset, String matchName, int[][] offsets ) + private void assertOccurrencesEqual(String source, int offset, String matchName, int[][] offsets ) { - occurrencesFinder.initialize(parse(source), offset, 0); - List <ISourcePosition> occurrences = occurrencesFinder.perform(); + occurrencesFinder.initialize(source, offset, 0); + List <Position> occurrences = occurrencesFinder.perform(); assertEquals( offsets.length, occurrences.size() ); for ( int i = 0; i < offsets.length; i++ ) { - assertEquals( offsets[i][0], occurrences.get(i).getStartOffset() ); - assertEquals( offsets[i][1], occurrences.get(i).getEndOffset() ); - assertEquals( matchName, source.substring(occurrences.get(i).getStartOffset(), occurrences.get(i).getEndOffset())); + int start = occurrences.get(i).getOffset(); + int end = occurrences.get(i).getOffset() + occurrences.get(i).getLength(); + assertEquals( offsets[i][0], start ); + assertEquals( offsets[i][1], end ); + assertEquals( matchName, source.substring(start, end)); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |