Search in sources :

Example 1 with ReferenceTestConfiguration

use of org.eclipse.xtext.testing.ReferenceTestConfiguration in project xtext-core by eclipse.

the class ReferenceTest method testReferences_03_acrossFiles.

@Test
public void testReferences_03_acrossFiles() {
    final Procedure1<ReferenceTestConfiguration> _function = (ReferenceTestConfiguration it) -> {
        StringConcatenation _builder = new StringConcatenation();
        _builder.append("type Foo {}");
        _builder.newLine();
        Pair<String, String> _mappedTo = Pair.<String, String>of("foo.testlang", _builder.toString());
        it.setFilesInScope(Collections.<String, CharSequence>unmodifiableMap(CollectionLiterals.<String, CharSequence>newHashMap(_mappedTo)));
        StringConcatenation _builder_1 = new StringConcatenation();
        _builder_1.append("type Bar {");
        _builder_1.newLine();
        _builder_1.append("    ");
        _builder_1.append("Foo foo");
        _builder_1.newLine();
        _builder_1.append("}");
        _builder_1.newLine();
        it.setModel(_builder_1.toString());
        it.setLine(1);
        it.setColumn(6);
        it.setIncludeDeclaration(true);
        StringConcatenation _builder_2 = new StringConcatenation();
        _builder_2.append("foo.testlang [[0, 5] .. [0, 8]]");
        _builder_2.newLine();
        _builder_2.append("MyModel.testlang [[1, 4] .. [1, 7]]");
        _builder_2.newLine();
        it.setExpectedReferences(_builder_2.toString());
    };
    this.testReferences(_function);
}
Also used : ReferenceTestConfiguration(org.eclipse.xtext.testing.ReferenceTestConfiguration) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) Pair(org.eclipse.xtext.xbase.lib.Pair) Test(org.junit.Test) AbstractTestLangLanguageServerTest(org.eclipse.xtext.ide.tests.server.AbstractTestLangLanguageServerTest)

Example 2 with ReferenceTestConfiguration

use of org.eclipse.xtext.testing.ReferenceTestConfiguration in project xtext-core by eclipse.

the class ReferenceTest method testReferences_02.

@Test
public void testReferences_02() {
    final Procedure1<ReferenceTestConfiguration> _function = (ReferenceTestConfiguration it) -> {
        StringConcatenation _builder = new StringConcatenation();
        _builder.append("type Foo {}");
        _builder.newLine();
        _builder.append("type Bar {");
        _builder.newLine();
        _builder.append("\t");
        _builder.append("Foo foo");
        _builder.newLine();
        _builder.append("}");
        _builder.newLine();
        it.setModel(_builder.toString());
        it.setColumn("type F".length());
        it.setIncludeDeclaration(true);
        StringConcatenation _builder_1 = new StringConcatenation();
        _builder_1.append("MyModel.testlang [[0, 5] .. [0, 8]]");
        _builder_1.newLine();
        _builder_1.append("MyModel.testlang [[2, 1] .. [2, 4]]");
        _builder_1.newLine();
        it.setExpectedReferences(_builder_1.toString());
    };
    this.testReferences(_function);
}
Also used : ReferenceTestConfiguration(org.eclipse.xtext.testing.ReferenceTestConfiguration) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) Test(org.junit.Test) AbstractTestLangLanguageServerTest(org.eclipse.xtext.ide.tests.server.AbstractTestLangLanguageServerTest)

Example 3 with ReferenceTestConfiguration

use of org.eclipse.xtext.testing.ReferenceTestConfiguration in project xtext-core by eclipse.

the class ReferenceTest method testReferences_01.

@Test
public void testReferences_01() {
    final Procedure1<ReferenceTestConfiguration> _function = (ReferenceTestConfiguration it) -> {
        StringConcatenation _builder = new StringConcatenation();
        _builder.append("type Foo {}");
        _builder.newLine();
        _builder.append("type Bar {");
        _builder.newLine();
        _builder.append("\t");
        _builder.append("Foo foo");
        _builder.newLine();
        _builder.append("}");
        _builder.newLine();
        it.setModel(_builder.toString());
        it.setColumn("type F".length());
        StringConcatenation _builder_1 = new StringConcatenation();
        _builder_1.append("MyModel.testlang [[2, 1] .. [2, 4]]");
        _builder_1.newLine();
        it.setExpectedReferences(_builder_1.toString());
    };
    this.testReferences(_function);
}
Also used : ReferenceTestConfiguration(org.eclipse.xtext.testing.ReferenceTestConfiguration) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) Test(org.junit.Test) AbstractTestLangLanguageServerTest(org.eclipse.xtext.ide.tests.server.AbstractTestLangLanguageServerTest)

Aggregations

StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)3 AbstractTestLangLanguageServerTest (org.eclipse.xtext.ide.tests.server.AbstractTestLangLanguageServerTest)3 ReferenceTestConfiguration (org.eclipse.xtext.testing.ReferenceTestConfiguration)3 Test (org.junit.Test)3 Pair (org.eclipse.xtext.xbase.lib.Pair)1