Package org.eclipse.xtext.resource

Examples of org.eclipse.xtext.resource.XtextResource


  }

  @Test
  public void test_Serialize_SmokeTest2() throws Exception {
    String code = "$a + $b\n";
    XtextResource r = getResourceFromString(code);
    String s = serialize(r.getContents().get(0));
    assertEquals("serialization should produce same result", code, s);
  }
View Full Code Here


  }

  @Test
  public void test_Serialize_SmokeTest2Formatted() throws Exception {
    String code = "$a + $b\n";
    XtextResource r = getResourceFromString(code);
    String s = serializeFormatted(r.getContents().get(0));
    assertEquals("serialization with formatting should produce same result", code, s);
  }
View Full Code Here

  }

  @Test
  public void test_Serialize_SmokeTest2Formatted2() throws Exception {
    String code = "$a+$b";
    XtextResource r = getResourceFromString(code);
    String s = serializeFormatted(r.getContents().get(0));
    assertEquals("serialization with formatting should add space around +", "$a + $b\n", s);
  }
View Full Code Here

  }

  @Test
  public void test_Serialize_SmokeTest2WithComment() throws Exception {
    String code = "$x = $a/* add a */+/* with b */$b\n";
    XtextResource r = getResourceFromString(code);
    String s = serializeFormatted(r.getContents().get(0));
    assertEquals(
      "serialization with formatting should add space around +", "$x = $a /* add a */ + /* with b */ $b\n", s);
  }
View Full Code Here

  }

  @Test
  public void test_Serialize_SmokeTest3() throws Exception {
    String code = "$a + 'apa'\n";
    XtextResource r = getResourceFromString(code);
    String s = serialize(r.getContents().get(0));
    assertEquals("serialization should produce same result", code, s);
  }
View Full Code Here

  public void test_SerializeCommentMix() throws Exception {
    String code = "/* 1 */ class /* 2 */ a /* 3 */ { /* 4 */\n" + //
        "  /* 5 */ $b /* 6 */ = /* 7 */ 10 /* 8 */\n" + //
        "/* 9 */ } /* 10 */\n" + //
        "/* 11 */\n";
    XtextResource r = getResourceFromString(code);
    String s = serialize(r.getContents().get(0));
    assertEquals("serialization should produce same result", code, s);
  }
View Full Code Here

  @Test
  public void test_variable_Gx_Gy() throws Exception {
    String code = "$y = 10\n" + //
        "$ref = $x\n" //
    ;
    XtextResource r = getResourceFromString(code);
    tester.validate(r.getContents().get(0)).assertOK();
    resourceWarningDiagnostics(r).assertDiagnostic(IPPDiagnostics.ISSUE__UNKNOWN_VARIABLE);
    resourceErrorDiagnostics(r).assertOK();
  }
View Full Code Here

    String code = "class a {\n" + //
        "$x = 10\n" + //
        "$ref = $x\n" + //
        "}\n"; //
    ;
    XtextResource r = getResourceFromString(code);
    tester.validate(r.getContents().get(0)).assertOK();
    resourceWarningDiagnostics(r).assertOK();
    resourceErrorDiagnostics(r).assertOK();
  }
View Full Code Here

        "$x = 10\n" + //
        "class b {\n" + //
        "$ref = $x\n" + //
        "}\n" + //
        "}\n"; //
    XtextResource r = getResourceFromString(code);
    tester.validate(r.getContents().get(0)).assertOK();
    resourceWarningDiagnostics(r).assertDiagnostic(IPPDiagnostics.ISSUE__UNKNOWN_VARIABLE);
    resourceErrorDiagnostics(r).assertOK();

  }
View Full Code Here

  @Test
  public void test_Issue_11() throws Exception {
    String code = "class xxx($p) {} class { 'xxx':\n" + //
        "p => '666',\n" + //
        "}\n";
    XtextResource r = getResourceFromString(code);
    tester.validate(r.getContents().get(0)).assertOK();
  }
View Full Code Here

TOP

Related Classes of org.eclipse.xtext.resource.XtextResource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.