use of org.eclipse.n4js.jsdoc.JSDocCharScanner in project n4js by eclipse.
the class TagTitleTokenizerTest method test.
@SuppressWarnings("javadoc")
@Test
public void test() {
TagTitleTokenizer tokenizer = new TagTitleTokenizer();
assertEquals(new JSDocToken("Test", 1, 4), tokenizer.nextToken(new JSDocCharScanner("@Test Hello World")));
assertEquals(new JSDocToken("Test", 1, 4), tokenizer.nextToken(new JSDocCharScanner("@Test\nHello World")));
assertEquals(new JSDocToken("Test", 1, 4), tokenizer.nextToken(new JSDocCharScanner("@Test\n * Hello World")));
assertNull(tokenizer.nextToken(new JSDocCharScanner("@ Hello World")));
assertNull(tokenizer.nextToken(new JSDocCharScanner("Test Hello World")));
assertNull(tokenizer.nextToken(new JSDocCharScanner("Test @Hello World")));
}
use of org.eclipse.n4js.jsdoc.JSDocCharScanner in project n4js by eclipse.
the class RegionTokenizerTest method testSimple.
@SuppressWarnings("javadoc")
@Test
public void testSimple() {
RegionTokenizer rt = new RegionTokenizer("{", "}", true, '\\', false, false);
JSDocCharScanner scanner = new JSDocCharScanner("{simple}");
assertEquals("simple", rt.nextToken(scanner).token);
scanner = new JSDocCharScanner("{simple} and more");
assertEquals("simple", rt.nextToken(scanner).token);
// ws are not skipped!
scanner = new JSDocCharScanner(" {simple} and more");
assertNull(rt.nextToken(scanner));
scanner = new JSDocCharScanner("{simple and more");
assertNull(rt.nextToken(scanner));
scanner = new JSDocCharScanner("simple} and more");
assertNull(rt.nextToken(scanner));
scanner = new JSDocCharScanner("x {simple} and more");
assertNull(rt.nextToken(scanner));
}
use of org.eclipse.n4js.jsdoc.JSDocCharScanner in project n4js by eclipse.
the class RegionTokenizerTest method testSimpleIncludeTags.
@SuppressWarnings("javadoc")
@Test
public void testSimpleIncludeTags() {
RegionTokenizer rt = new RegionTokenizer("{", "}", true, '\\', true, false);
JSDocCharScanner scanner = new JSDocCharScanner("{simple}");
assertEquals("{simple}", rt.nextToken(scanner).token);
scanner = new JSDocCharScanner("{simple} and more");
assertEquals("{simple}", rt.nextToken(scanner).token);
}
use of org.eclipse.n4js.jsdoc.JSDocCharScanner in project n4js by eclipse.
the class TextTokenizerTest method testLinebreak.
@SuppressWarnings("javadoc")
@Test
public void testLinebreak() {
TextTokenizer TEXT = TextTokenizer.INSTANCE;
assertEquals(new JSDocToken("Hello World\n", 7, 18), TEXT.nextToken(new JSDocCharScanner("/**\n * Hello World\n * Skipped */")));
assertEquals(new JSDocToken("Hello World", 7, 17), TEXT.nextToken(new JSDocCharScanner("/**\n * Hello World\n * @tag Skipped */")));
assertEquals(new JSDocToken("Hello World", 7, 17), TEXT.nextToken(new JSDocCharScanner("/**\n * Hello World\n */")));
}
use of org.eclipse.n4js.jsdoc.JSDocCharScanner in project n4js by eclipse.
the class TextTokenizerTest method testEmpty.
@SuppressWarnings("javadoc")
@Test
public void testEmpty() {
TextTokenizer TEXT = TextTokenizer.INSTANCE;
assertEquals(new JSDocToken("\n", 1, 1), TEXT.nextToken(new JSDocCharScanner("x\n cont", 1)));
assertNull(TEXT.nextToken(new JSDocCharScanner("x*/", 1)));
}
Aggregations