Search in sources :

Example 16 with Model

use of org.eclipse.xtext.parsetree.impl.bug305397.Model in project xtext-core by eclipse.

the class Bug299395Test method testSerialization_03.

@Test
public void testSerialization_03() {
    Model model = Bug299395Factory.eINSTANCE.createModel();
    model.getStrings().add("Foo");
    model.getStrings().add("Bar");
    model.getStrings().add("Zonk");
    String serialized = getSerializer().serialize(model);
    assertEquals("{ \"Foo\" } { \"Bar\" } { \"Zonk\" }", serialized);
}
Also used : Model(org.eclipse.xtext.parsetree.reconstr.bug299395.Model) SubModel(org.eclipse.xtext.parsetree.reconstr.bug299395.SubModel) Test(org.junit.Test)

Example 17 with Model

use of org.eclipse.xtext.parsetree.impl.bug305397.Model in project xtext-core by eclipse.

the class Bug299395Test method testSerialization_05.

@Test
public void testSerialization_05() {
    Model model = Bug299395Factory.eINSTANCE.createModel();
    model.getStrings().add("Unused");
    model.getKeys().add("Key1");
    model.getValues().add("Value1");
    model.getKeys().add("Key2");
    model.getValues().add("Value2");
    String serialized = getSerializer().serialize(model);
    assertEquals("{ \"Unused\" } [ \"Key1\" \"Value1\" \"Key2\" \"Value2\" ]", serialized);
}
Also used : Model(org.eclipse.xtext.parsetree.reconstr.bug299395.Model) SubModel(org.eclipse.xtext.parsetree.reconstr.bug299395.SubModel) Test(org.junit.Test)

Example 18 with Model

use of org.eclipse.xtext.parsetree.impl.bug305397.Model in project xtext-core by eclipse.

the class Bug299395Test method testSerialization_06.

@Test
public void testSerialization_06() {
    Model model = Bug299395Factory.eINSTANCE.createModel();
    SubModel subModel = Bug299395Factory.eINSTANCE.createSubModel();
    model.setSubModel(subModel);
    String serialized = getSerializer().serialize(model);
    assertEquals("subModel", serialized);
}
Also used : Model(org.eclipse.xtext.parsetree.reconstr.bug299395.Model) SubModel(org.eclipse.xtext.parsetree.reconstr.bug299395.SubModel) SubModel(org.eclipse.xtext.parsetree.reconstr.bug299395.SubModel) Test(org.junit.Test)

Example 19 with Model

use of org.eclipse.xtext.parsetree.impl.bug305397.Model in project xtext-core by eclipse.

the class Bug299395Test method testSerialization_02.

@Test
public void testSerialization_02() {
    Model model = Bug299395Factory.eINSTANCE.createModel();
    model.getStrings().add("Foo");
    String serialized = getSerializer().serialize(model);
    assertEquals("{ \"Foo\" }", serialized);
}
Also used : Model(org.eclipse.xtext.parsetree.reconstr.bug299395.Model) SubModel(org.eclipse.xtext.parsetree.reconstr.bug299395.SubModel) Test(org.junit.Test)

Example 20 with Model

use of org.eclipse.xtext.parsetree.impl.bug305397.Model in project xtext-core by eclipse.

the class Bug302128Test method testTheBug2.

@Test
public void testTheBug2() throws Exception {
    with(new Bug302128TestLanguageStandaloneSetup());
    String text = "VARIABLE += value.val value2.val\n" + "VARIABLE2 += value3.val value4.val\n\n" + "#Comment comment comment\n\n" + "VARIABLE3 += value5.val value6.val\n" + "VARIABLE4 += value.val value2.val\n" + "VARIABLE5 += value3.val value4.val\n\n" + "#Comment comment comment\n\n" + "VARIABLE.varible += value5.val value6.val\n";
    XtextResource resource = getResource(new StringInputStream(text));
    Model model = (Model) resource.getContents().get(0);
    model.getElements().get(2).setValue("+= value5.val value6.val\n");
    ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
    resource.save(outputStream, null);
    assertEquals(text, new String(outputStream.toByteArray()));
}
Also used : StringInputStream(org.eclipse.xtext.util.StringInputStream) Model(org.eclipse.xtext.parsetree.reconstr.bug302128.Model) XtextResource(org.eclipse.xtext.resource.XtextResource) ByteArrayOutputStream(java.io.ByteArrayOutputStream) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)41 Model (org.eclipse.xtext.valueconverter.bug250313.Model)30 ICompositeNode (org.eclipse.xtext.nodemodel.ICompositeNode)16 ILeafNode (org.eclipse.xtext.nodemodel.ILeafNode)11 Model (org.eclipse.xtext.parsetree.reconstr.bug299395.Model)9 SubModel (org.eclipse.xtext.parsetree.reconstr.bug299395.SubModel)9 EPackage (org.eclipse.emf.ecore.EPackage)6 Action (org.eclipse.xtext.Action)6 Parameter (org.eclipse.xtext.Parameter)6 ParserRule (org.eclipse.xtext.ParserRule)6 Model (org.eclipse.xtext.linking.bug362902.Model)2 Model (org.eclipse.xtext.linking.lazy.bug311337.Model)2 Element (org.eclipse.xtext.parsetree.impl.bug305397.Element)2 Model (org.eclipse.xtext.parsetree.impl.bug305397.Model)2 Model (org.eclipse.xtext.parsetree.reconstr.bug302128.Model)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 Diagnostic (org.eclipse.emf.ecore.resource.Resource.Diagnostic)1 Greeting (org.eclipse.xtext.linking.bug362902.Greeting)1 XtextLinkingDiagnostic (org.eclipse.xtext.linking.impl.XtextLinkingDiagnostic)1 Child (org.eclipse.xtext.linking.lazy.bug311337.Child)1