Search in sources :

Example 1 with OptionalValue

use of org.eclipse.xtext.ide.tests.testlanguage.partialSerializationTestLanguage.OptionalValue in project xtext-core by eclipse.

the class PartialSerializerTest method testOptionalValueInsert.

@Test
public void testOptionalValueInsert() {
    final IChangeSerializer.IModification<OptionalValue> _function = (OptionalValue it) -> {
        it.setName("foo");
    };
    ITextRegionAccess _recordDiff = this.<OptionalValue>recordDiff(OptionalValue.class, "#3", _function);
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("0 0 1 H");
    _builder.newLine();
    _builder.append("      ");
    _builder.append("B OptionalValue\'foo\'   Model");
    _builder.newLine();
    _builder.append("0 2 1  S \"#3\"                 Model:\'#3\'");
    _builder.newLine();
    _builder.append("2 0 1  H");
    _builder.newLine();
    _builder.append("2 3 1  S \"foo\"                OptionalValue:name=ID");
    _builder.newLine();
    _builder.append("      ");
    _builder.append("E OptionalValue\'foo\'   Model");
    _builder.newLine();
    _builder.append("5 0 1 H");
    _builder.newLine();
    _builder.append("------------ diff 1 ------------");
    _builder.newLine();
    _builder.append("0 0 H");
    _builder.newLine();
    _builder.append("0 2 S \"#3\"                 Model:\'#3\'");
    _builder.newLine();
    _builder.append("2 0 H");
    _builder.newLine();
    this._changeSerializerTestHelper.operator_tripleEquals(_recordDiff, _builder);
}
Also used : ITextRegionAccess(org.eclipse.xtext.formatting2.regionaccess.ITextRegionAccess) IChangeSerializer(org.eclipse.xtext.ide.serializer.IChangeSerializer) OptionalValue(org.eclipse.xtext.ide.tests.testlanguage.partialSerializationTestLanguage.OptionalValue) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) Test(org.junit.Test)

Example 2 with OptionalValue

use of org.eclipse.xtext.ide.tests.testlanguage.partialSerializationTestLanguage.OptionalValue in project xtext-core by eclipse.

the class PartialSerializerTest method testOptionalValueRemove.

@Test
public void testOptionalValueRemove() {
    final IChangeSerializer.IModification<OptionalValue> _function = (OptionalValue it) -> {
        it.setName(null);
    };
    ITextRegionAccess _recordDiff = this.<OptionalValue>recordDiff(OptionalValue.class, "#3 foo", _function);
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("0 0   H");
    _builder.newLine();
    _builder.append("      ");
    _builder.append("B OptionalValue        Model");
    _builder.newLine();
    _builder.append("0 2    S \"#3\"                 Model:\'#3\'");
    _builder.newLine();
    _builder.append("      ");
    _builder.append("E OptionalValue        Model");
    _builder.newLine();
    _builder.append("2 1 1 H \" \"                  Whitespace:TerminalRule\'WS\'");
    _builder.newLine();
    _builder.append("------------ diff 1 ------------");
    _builder.newLine();
    _builder.append("2 1  H \" \"                  Whitespace:TerminalRule\'WS\'");
    _builder.newLine();
    _builder.append("3 3  S \"foo\"                OptionalValue:name=ID");
    _builder.newLine();
    _builder.append("6 0  H");
    _builder.newLine();
    this._changeSerializerTestHelper.operator_tripleEquals(_recordDiff, _builder);
}
Also used : ITextRegionAccess(org.eclipse.xtext.formatting2.regionaccess.ITextRegionAccess) IChangeSerializer(org.eclipse.xtext.ide.serializer.IChangeSerializer) OptionalValue(org.eclipse.xtext.ide.tests.testlanguage.partialSerializationTestLanguage.OptionalValue) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) Test(org.junit.Test)

Example 3 with OptionalValue

use of org.eclipse.xtext.ide.tests.testlanguage.partialSerializationTestLanguage.OptionalValue in project xtext-core by eclipse.

the class PartialSerializerTest method testOptionalValueChange.

@Test
public void testOptionalValueChange() {
    final IChangeSerializer.IModification<OptionalValue> _function = (OptionalValue it) -> {
        it.setName("baz");
    };
    ITextRegionAccess _recordDiff = this.<OptionalValue>recordDiff(OptionalValue.class, "#3 foo", _function);
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("0 0   H");
    _builder.newLine();
    _builder.append("      ");
    _builder.append("B OptionalValue\'baz\'   Model");
    _builder.newLine();
    _builder.append("0 2    S \"#3\"                 Model:\'#3\'");
    _builder.newLine();
    _builder.append("2 1    H \" \"                  Whitespace:TerminalRule\'WS\'");
    _builder.newLine();
    _builder.append("3 3 1  S \"baz\"                OptionalValue:name=ID");
    _builder.newLine();
    _builder.append("      ");
    _builder.append("E OptionalValue\'baz\'   Model");
    _builder.newLine();
    _builder.append("6 0   H");
    _builder.newLine();
    _builder.append("------------ diff 1 ------------");
    _builder.newLine();
    _builder.append("3 3 S \"foo\"                OptionalValue:name=ID");
    _builder.newLine();
    this._changeSerializerTestHelper.operator_tripleEquals(_recordDiff, _builder);
}
Also used : ITextRegionAccess(org.eclipse.xtext.formatting2.regionaccess.ITextRegionAccess) IChangeSerializer(org.eclipse.xtext.ide.serializer.IChangeSerializer) OptionalValue(org.eclipse.xtext.ide.tests.testlanguage.partialSerializationTestLanguage.OptionalValue) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) Test(org.junit.Test)

Aggregations

StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)3 ITextRegionAccess (org.eclipse.xtext.formatting2.regionaccess.ITextRegionAccess)3 IChangeSerializer (org.eclipse.xtext.ide.serializer.IChangeSerializer)3 OptionalValue (org.eclipse.xtext.ide.tests.testlanguage.partialSerializationTestLanguage.OptionalValue)3 Test (org.junit.Test)3