Search in sources :

Example 1 with TraceRegionToStringTester

use of org.eclipse.xtext.generator.trace.TraceRegionToStringTester in project xtext-core by eclipse.

the class TraceRegionToStringTest method oneChild.

@Test
public void oneChild() {
    final TraceRegionToStringTester tester = new TraceRegionToStringTester();
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("foo bar");
    _builder.newLine();
    tester.setLocalText(_builder.toString());
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("baz buz");
    _builder_1.newLine();
    tester.setRemote1(_builder_1.toString());
    SourceRelativeURI _uri1 = tester.getUri1();
    TraceRegionToStringTester.Location _location = new TraceRegionToStringTester.Location(1, 6, _uri1);
    TraceRegionToStringTester.Region _region = new TraceRegionToStringTester.Region(0, 7, Collections.<ILocationData>unmodifiableList(CollectionLiterals.<ILocationData>newArrayList(_location)));
    final Procedure1<TraceRegionToStringTester.Region> _function = (TraceRegionToStringTester.Region it) -> {
        TraceRegionToStringTester.Location _location_1 = new TraceRegionToStringTester.Location(2, 4);
        it.addChild(1, 6, Collections.<ILocationData>unmodifiableList(CollectionLiterals.<ILocationData>newArrayList(_location_1)));
    };
    TraceRegionToStringTester.Region _doubleArrow = ObjectExtensions.<TraceRegionToStringTester.Region>operator_doubleArrow(_region, _function);
    tester.setTrace(_doubleArrow);
    StringConcatenation _builder_2 = new StringConcatenation();
    _builder_2.append("----- local1 ----- | ----- remote1 -----");
    _builder_2.newLine();
    _builder_2.append("[1[f[2[oo bar]2,1] | b[1[a[2[z bu]2]z]1]");
    _builder_2.newLine();
    _builder_2.append("----------------------------------------");
    _builder_2.newLine();
    _builder_2.append("1: D 0-7 Region -> Location[1,6,remote1] {");
    _builder_2.newLine();
    _builder_2.append("2: D 1-6   Region -> Location[2,4]");
    _builder_2.newLine();
    _builder_2.append("1:       }");
    _builder_2.newLine();
    this.operator_tripleEquals(tester, _builder_2);
}
Also used : StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) TextRegion(org.eclipse.xtext.util.TextRegion) TraceRegionToStringTester(org.eclipse.xtext.generator.trace.TraceRegionToStringTester) SourceRelativeURI(org.eclipse.xtext.generator.trace.SourceRelativeURI) ILocationData(org.eclipse.xtext.generator.trace.ILocationData) Test(org.junit.Test)

Example 2 with TraceRegionToStringTester

use of org.eclipse.xtext.generator.trace.TraceRegionToStringTester in project xtext-core by eclipse.

the class TraceRegionToStringTest method simple.

@Test
public void simple() {
    final TraceRegionToStringTester tester = new TraceRegionToStringTester();
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("foo bar");
    _builder.newLine();
    tester.setLocalText(_builder.toString());
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("baz buz");
    _builder_1.newLine();
    tester.setRemote1(_builder_1.toString());
    SourceRelativeURI _uri1 = tester.getUri1();
    TraceRegionToStringTester.Location _location = new TraceRegionToStringTester.Location(4, 2, _uri1);
    TraceRegionToStringTester.Region _region = new TraceRegionToStringTester.Region(1, 2, Collections.<ILocationData>unmodifiableList(CollectionLiterals.<ILocationData>newArrayList(_location)));
    tester.setTrace(_region);
    StringConcatenation _builder_2 = new StringConcatenation();
    _builder_2.append("-- local1 --- | -- remote1 --");
    _builder_2.newLine();
    _builder_2.append("f[1[oo]1] bar | baz [1[bu]1]z");
    _builder_2.newLine();
    _builder_2.append("-----------------------------");
    _builder_2.newLine();
    _builder_2.append("1: D 1-2 Region -> Location[4,2,remote1]");
    _builder_2.newLine();
    this.operator_tripleEquals(tester, _builder_2);
}
Also used : StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) TextRegion(org.eclipse.xtext.util.TextRegion) TraceRegionToStringTester(org.eclipse.xtext.generator.trace.TraceRegionToStringTester) SourceRelativeURI(org.eclipse.xtext.generator.trace.SourceRelativeURI) ILocationData(org.eclipse.xtext.generator.trace.ILocationData) Test(org.junit.Test)

Example 3 with TraceRegionToStringTester

use of org.eclipse.xtext.generator.trace.TraceRegionToStringTester in project xtext-core by eclipse.

the class TraceRegionToStringTest method twoFrame2.

@Test
public void twoFrame2() {
    final TraceRegionToStringTester tester = new TraceRegionToStringTester();
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("foo bar");
    _builder.newLine();
    tester.setLocalText(_builder.toString());
    TextRegion _textRegion = new TextRegion(2, 4);
    tester.setLocalFrame(_textRegion);
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("baz buz");
    _builder_1.newLine();
    tester.setRemote1(_builder_1.toString());
    SourceRelativeURI _uri1 = tester.getUri1();
    TraceRegionToStringTester.Location _location = new TraceRegionToStringTester.Location(1, 5, _uri1);
    TraceRegionToStringTester.Region _region = new TraceRegionToStringTester.Region(0, 7, Collections.<ILocationData>unmodifiableList(CollectionLiterals.<ILocationData>newArrayList(_location)));
    final Procedure1<TraceRegionToStringTester.Region> _function = (TraceRegionToStringTester.Region it) -> {
        TraceRegionToStringTester.Location _location_1 = new TraceRegionToStringTester.Location(1, 5);
        it.addChild(2, 1, Collections.<ILocationData>unmodifiableList(CollectionLiterals.<ILocationData>newArrayList(_location_1)));
        TraceRegionToStringTester.Location _location_2 = new TraceRegionToStringTester.Location(1, 5);
        it.addChild(5, 1, Collections.<ILocationData>unmodifiableList(CollectionLiterals.<ILocationData>newArrayList(_location_2)));
    };
    TraceRegionToStringTester.Region _doubleArrow = ObjectExtensions.<TraceRegionToStringTester.Region>operator_doubleArrow(_region, _function);
    tester.setTrace(_doubleArrow);
    StringConcatenation _builder_2 = new StringConcatenation();
    _builder_2.append("---- local1 ---- | ---- remote1 ----");
    _builder_2.newLine();
    _builder_2.append("[1[o]1] b[2[a]2] | b[1,2[az bu]2,1]z");
    _builder_2.newLine();
    _builder_2.append("------------------------------------");
    _builder_2.newLine();
    _builder_2.append("1: D 2-1 Region -> Location[1,5]");
    _builder_2.newLine();
    _builder_2.append("2: D 5-1 Region -> Location[1,5]");
    _builder_2.newLine();
    this.operator_tripleEquals(tester, _builder_2);
}
Also used : TextRegion(org.eclipse.xtext.util.TextRegion) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) TextRegion(org.eclipse.xtext.util.TextRegion) TraceRegionToStringTester(org.eclipse.xtext.generator.trace.TraceRegionToStringTester) SourceRelativeURI(org.eclipse.xtext.generator.trace.SourceRelativeURI) ILocationData(org.eclipse.xtext.generator.trace.ILocationData) Test(org.junit.Test)

Example 4 with TraceRegionToStringTester

use of org.eclipse.xtext.generator.trace.TraceRegionToStringTester in project xtext-core by eclipse.

the class TraceRegionToStringTest method twoBounding.

@Test
public void twoBounding() {
    final TraceRegionToStringTester tester = new TraceRegionToStringTester();
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("foobar");
    _builder.newLine();
    tester.setLocalText(_builder.toString());
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("bazbuz");
    _builder_1.newLine();
    tester.setRemote1(_builder_1.toString());
    SourceRelativeURI _uri1 = tester.getUri1();
    TraceRegionToStringTester.Location _location = new TraceRegionToStringTester.Location(0, 6, _uri1);
    TraceRegionToStringTester.Region _region = new TraceRegionToStringTester.Region(0, 6, Collections.<ILocationData>unmodifiableList(CollectionLiterals.<ILocationData>newArrayList(_location)));
    final Procedure1<TraceRegionToStringTester.Region> _function = (TraceRegionToStringTester.Region it) -> {
        TraceRegionToStringTester.Location _location_1 = new TraceRegionToStringTester.Location(0, 3);
        it.addChild(0, 3, Collections.<ILocationData>unmodifiableList(CollectionLiterals.<ILocationData>newArrayList(_location_1)));
        TraceRegionToStringTester.Location _location_2 = new TraceRegionToStringTester.Location(3, 3);
        it.addChild(3, 3, Collections.<ILocationData>unmodifiableList(CollectionLiterals.<ILocationData>newArrayList(_location_2)));
    };
    TraceRegionToStringTester.Region _doubleArrow = ObjectExtensions.<TraceRegionToStringTester.Region>operator_doubleArrow(_region, _function);
    tester.setTrace(_doubleArrow);
    StringConcatenation _builder_2 = new StringConcatenation();
    _builder_2.append("------- local1 ------- | ------ remote1 -------");
    _builder_2.newLine();
    _builder_2.append("[1,2[foo]2][3[bar]3,1] | [1,2[baz]2][3[buz]3,1]");
    _builder_2.newLine();
    _builder_2.append("-----------------------------------------------");
    _builder_2.newLine();
    _builder_2.append("1: D 0-6 Region -> Location[0,6,remote1] {");
    _builder_2.newLine();
    _builder_2.append("2: D 0-3   Region -> Location[0,3]");
    _builder_2.newLine();
    _builder_2.append("3: D 3-3   Region -> Location[3,3]");
    _builder_2.newLine();
    _builder_2.append("1:       }");
    _builder_2.newLine();
    this.operator_tripleEquals(tester, _builder_2);
}
Also used : StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) TextRegion(org.eclipse.xtext.util.TextRegion) TraceRegionToStringTester(org.eclipse.xtext.generator.trace.TraceRegionToStringTester) SourceRelativeURI(org.eclipse.xtext.generator.trace.SourceRelativeURI) ILocationData(org.eclipse.xtext.generator.trace.ILocationData) Test(org.junit.Test)

Example 5 with TraceRegionToStringTester

use of org.eclipse.xtext.generator.trace.TraceRegionToStringTester in project xtext-core by eclipse.

the class TraceRegionToStringTest method twoFrame1.

@Test
public void twoFrame1() {
    final TraceRegionToStringTester tester = new TraceRegionToStringTester();
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("foo bar");
    _builder.newLine();
    tester.setLocalText(_builder.toString());
    TextRegion _textRegion = new TextRegion(1, 5);
    tester.setLocalFrame(_textRegion);
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("baz buz");
    _builder_1.newLine();
    tester.setRemote1(_builder_1.toString());
    SourceRelativeURI _uri1 = tester.getUri1();
    TraceRegionToStringTester.Location _location = new TraceRegionToStringTester.Location(1, 5, _uri1);
    TraceRegionToStringTester.Region _region = new TraceRegionToStringTester.Region(0, 7, Collections.<ILocationData>unmodifiableList(CollectionLiterals.<ILocationData>newArrayList(_location)));
    final Procedure1<TraceRegionToStringTester.Region> _function = (TraceRegionToStringTester.Region it) -> {
        TraceRegionToStringTester.Location _location_1 = new TraceRegionToStringTester.Location(1, 5);
        it.addChild(2, 1, Collections.<ILocationData>unmodifiableList(CollectionLiterals.<ILocationData>newArrayList(_location_1)));
        TraceRegionToStringTester.Location _location_2 = new TraceRegionToStringTester.Location(1, 5);
        it.addChild(5, 1, Collections.<ILocationData>unmodifiableList(CollectionLiterals.<ILocationData>newArrayList(_location_2)));
    };
    TraceRegionToStringTester.Region _doubleArrow = ObjectExtensions.<TraceRegionToStringTester.Region>operator_doubleArrow(_region, _function);
    tester.setTrace(_doubleArrow);
    StringConcatenation _builder_2 = new StringConcatenation();
    _builder_2.append("---- local1 ----- | ---- remote1 ----");
    _builder_2.newLine();
    _builder_2.append("o[1[o]1] b[2[a]2] | b[1,2[az bu]2,1]z");
    _builder_2.newLine();
    _builder_2.append("-------------------------------------");
    _builder_2.newLine();
    _builder_2.append("1: D 2-1 Region -> Location[1,5]");
    _builder_2.newLine();
    _builder_2.append("2: D 5-1 Region -> Location[1,5]");
    _builder_2.newLine();
    this.operator_tripleEquals(tester, _builder_2);
}
Also used : TextRegion(org.eclipse.xtext.util.TextRegion) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) TextRegion(org.eclipse.xtext.util.TextRegion) TraceRegionToStringTester(org.eclipse.xtext.generator.trace.TraceRegionToStringTester) SourceRelativeURI(org.eclipse.xtext.generator.trace.SourceRelativeURI) ILocationData(org.eclipse.xtext.generator.trace.ILocationData) Test(org.junit.Test)

Aggregations

StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)7 ILocationData (org.eclipse.xtext.generator.trace.ILocationData)7 SourceRelativeURI (org.eclipse.xtext.generator.trace.SourceRelativeURI)7 TraceRegionToStringTester (org.eclipse.xtext.generator.trace.TraceRegionToStringTester)7 TextRegion (org.eclipse.xtext.util.TextRegion)7 Test (org.junit.Test)7