Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add unit tests for SingleTokenScanner

  • Loading branch information...
commit ec1347c10a1df99e5ba37a4ae59f5a2d3b22c2d1 1 parent f07dc3b
@sgtcoolguy sgtcoolguy authored
View
4 tests/com.aptana.editor.common.tests/src/com/aptana/editor/common/tests/AllTests.java
@@ -16,7 +16,7 @@
import com.aptana.editor.common.scripting.ScriptingInputOutputTest;
import com.aptana.editor.common.scripting.commands.ScriptingCommandsTests;
import com.aptana.editor.common.scripting.snippets.SnippetsTests;
-import com.aptana.editor.common.text.RubyRegexpAutoIndentStrategyTest;
+import com.aptana.editor.common.text.TextTests;
import com.aptana.editor.common.text.reconciler.ReconcilerTests;
import com.aptana.editor.common.text.rules.RulesTests;
import com.aptana.editor.common.util.UtilTests;
@@ -36,11 +36,11 @@ public static Test suite()
suite.addTest(SnippetsTests.suite());
suite.addTest(ReconcilerTests.suite());
suite.addTest(ScriptingCommandsTests.suite());
+ suite.addTest(TextTests.suite());
suite.addTest(UtilTests.suite());
suite.addTest(ValidationTests.suite());
suite.addTest(ViewerTests.suite());
suite.addTestSuite(ScriptingInputOutputTest.class);
- suite.addTestSuite(RubyRegexpAutoIndentStrategyTest.class);
suite.addTestSuite(DocumentScopeManagerTest.class);
// $JUnit-END$
return suite;
View
22 ....aptana.editor.common.tests/src/com/aptana/editor/common/text/SingleTokenScannerTest.java
@@ -0,0 +1,22 @@
+package com.aptana.editor.common.text;
+
+import junit.framework.TestCase;
+
+import org.eclipse.jface.text.rules.IToken;
+import org.eclipse.jface.text.rules.Token;
+
+public class SingleTokenScannerTest extends TestCase
+{
+
+ public void testReturnsSingleTokenForEntireRangeAndThenEOF() throws Exception
+ {
+ IToken token = new Token("my_token");
+ SingleTokenScanner scanner = new SingleTokenScanner(token);
+ scanner.setRange(null, 0, 100);
+ assertEquals(token, scanner.nextToken());
+ assertEquals(0, scanner.getTokenOffset());
+ assertEquals(100, scanner.getTokenLength());
+ assertEquals(Token.EOF, scanner.nextToken());
+ }
+
+}
View
20 tests/com.aptana.editor.common.tests/src/com/aptana/editor/common/text/TextTests.java
@@ -0,0 +1,20 @@
+package com.aptana.editor.common.text;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+public class TextTests extends TestCase
+{
+
+ public static Test suite()
+ {
+ TestSuite suite = new TestSuite(TextTests.class.getName());
+ //$JUnit-BEGIN$
+ suite.addTestSuite(RubyRegexpAutoIndentStrategyTest.class);
+ suite.addTestSuite(SingleTokenScannerTest.class);
+ //$JUnit-END$
+ return suite;
+ }
+
+}
Please sign in to comment.
Something went wrong with that request. Please try again.