use of org.eclipse.xtext.ui.editor.folding.FoldedPosition in project xtext-xtend by eclipse.
the class XtendFoldingRegionProviderTest method testRichString_02.
@Test
public void testRichString_02() throws Exception {
String content = "class Foo {\n" + " def void xxx() {\n" + " println('''x y''')\n" + " }\n" + "}";
Collection<FoldedPosition> foldingRegions = calculateFoldingRegions("test/Foo", content);
assertEquals(2, foldingRegions.size());
Iterator<FoldedPosition> iterator = foldingRegions.iterator();
FoldedPosition next = iterator.next();
assertEquals(0, next.offset);
assertEquals(59, next.length);
next = iterator.next();
assertEquals(12, next.offset);
assertEquals(46, next.length);
}
use of org.eclipse.xtext.ui.editor.folding.FoldedPosition in project xtext-xtend by eclipse.
the class XtendFoldingRegionProviderTest method testFoldSetLiteral_01.
@Test
public void testFoldSetLiteral_01() throws Exception {
String content = "class Foo {\n" + " def xxx() {\n" + " #{\n" + " 1,\n" + " 2\n" + " }\n" + " }\n" + "}";
Collection<FoldedPosition> foldingRegions = calculateFoldingRegions("test/Foo", content);
assertEquals(3, foldingRegions.size());
Iterator<FoldedPosition> iterator = foldingRegions.iterator();
FoldedPosition next = iterator.next();
assertEquals(0, next.offset);
assertEquals(61, next.length);
next = iterator.next();
assertEquals(12, next.offset);
assertEquals(48, next.length);
next = iterator.next();
assertEquals(26, next.offset);
assertEquals(30, next.length);
}
use of org.eclipse.xtext.ui.editor.folding.FoldedPosition in project xtext-xtend by eclipse.
the class XtendFoldingRegionProviderTest method testFoldClosure_01.
@Test
public void testFoldClosure_01() throws Exception {
String content = "class Foo {\n" + " def void xxx() {\n" + " #[1,2,3].filter [\n" + " println(it)\n" + " it%2==0\n" + " ]\n" + " }\n" + "}";
Collection<FoldedPosition> foldingRegions = calculateFoldingRegions("test/Foo", content);
assertEquals(3, foldingRegions.size());
Iterator<FoldedPosition> iterator = foldingRegions.iterator();
FoldedPosition next = iterator.next();
assertEquals(0, next.offset);
assertEquals(96, next.length);
next = iterator.next();
assertEquals(12, next.offset);
assertEquals(83, next.length);
next = iterator.next();
assertEquals(31, next.offset);
assertEquals(60, next.length);
}
use of org.eclipse.xtext.ui.editor.folding.FoldedPosition in project xtext-xtend by eclipse.
the class XtendFoldingRegionProviderTest method testFoldRichString_01.
@Test
public void testFoldRichString_01() throws Exception {
String content = "class Foo {\n" + " def void xxx() {\n" + " println('''\n" + " x\n" + " y\n" + " ''')\n" + " }\n" + "}";
Collection<FoldedPosition> foldingRegions = calculateFoldingRegions("test/Foo", content);
assertEquals(3, foldingRegions.size());
Iterator<FoldedPosition> iterator = foldingRegions.iterator();
FoldedPosition next = iterator.next();
assertEquals(0, next.offset);
assertEquals(77, next.length);
next = iterator.next();
assertEquals(12, next.offset);
assertEquals(64, next.length);
next = iterator.next();
assertEquals(31, next.offset);
assertEquals(41, next.length);
}
use of org.eclipse.xtext.ui.editor.folding.FoldedPosition in project xtext-xtend by eclipse.
the class XtendFoldingRegionProviderTest method testFoldListLiteral_01.
@Test
public void testFoldListLiteral_01() throws Exception {
String content = "class Foo {\n" + " def xxx() {\n" + " #[\n" + " 1,\n" + " 2\n" + " ]\n" + " }\n" + "}";
Collection<FoldedPosition> foldingRegions = calculateFoldingRegions("test/Foo", content);
assertEquals(3, foldingRegions.size());
Iterator<FoldedPosition> iterator = foldingRegions.iterator();
FoldedPosition next = iterator.next();
assertEquals(0, next.offset);
assertEquals(61, next.length);
next = iterator.next();
assertEquals(12, next.offset);
assertEquals(48, next.length);
next = iterator.next();
assertEquals(26, next.offset);
assertEquals(30, next.length);
}
Aggregations