Examples of XtextResource


Examples of org.eclipse.xtext.resource.XtextResource

  }

  @Test
  public void test_Serialize_ImportExpressionDq() throws Exception {
    String code = "import \"a\"\nimport \"b\"\n";
    XtextResource r = getResourceFromString(code);
    String s = serializeFormatted(r.getContents().get(0));

    // DEBUG
    // System.out.println(NodeModelUtils.compactDump(r.getParseResult().getRootNode(), false));

    assertEquals("serialization should produce specified result", code, s);
View Full Code Here

Examples of org.eclipse.xtext.resource.XtextResource

  }

  @Test
  public void test_Serialize_ImportExpressionSq() throws Exception {
    String code = "import 'a'\nimport 'b'\n";
    XtextResource r = getResourceFromString(code);
    String s = serializeFormatted(r.getContents().get(0));
    // DEBUG
    // System.out.println(NodeModelUtils.compactDump(r.getParseResult().getRootNode(), false));

    assertEquals("serialization should produce specified result", code, s);
  }
View Full Code Here

Examples of org.eclipse.xtext.resource.XtextResource

  @Test
  public void test_Serialize_NodeDefinition() throws Exception {
    String code = "node a {$a=1 $b=2}";
    String fmt = "node a {\n  $a = 1\n  $b = 2\n}\n";
    XtextResource r = getResourceFromString(code);
    String s = serializeFormatted(r.getContents().get(0));
    assertEquals("serialization should produce specified result", fmt, s);

  }
View Full Code Here

Examples of org.eclipse.xtext.resource.XtextResource

  }

  @Test
  public void test_Comment_acceptedAsBreak() throws Exception {
    String code = "node x { # comment\n}\n";
    XtextResource r = getResourceFromString(code);
    String s = serializeFormatted(r.getContents().get(0));
    assertEquals("formatting should produce wanted result", code, s);
  }
View Full Code Here

Examples of org.eclipse.xtext.resource.XtextResource

  @Test
  public void test_Comment_InLineML() throws Exception {
    // source with space after inline comment
    String code = "$a = 1 + /* x */ 2\n";
    XtextResource r = getResourceFromString(code);
    String s = serializeFormatted(r.getContents().get(0));
    assertEquals("formatting should produce wanted result", code, s);

    // source without space after inline comment (one should be added).
    String code2 = "$a = 1 + /* x */2\n";
    r = getResourceFromString(code2);
    s = serializeFormatted(r.getContents().get(0));
    assertEquals("formatting should produce wanted result", code, s);

  }
View Full Code Here

Examples of org.eclipse.xtext.resource.XtextResource

    for(int i = 0; i < 133; i++)
      builder.append("f");
    String _133f = builder.toString();
    String code = "# ok askdj faoskdjf oalskdjf aalksjf alskdjf kdj " + _133f + " ffffffffffff\n";
    String expected = "# ok askdj faoskdjf oalskdjf aalksjf alskdjf kdj\n# " + _133f + "\n# ffffffffffff\n";
    XtextResource r = getResourceFromString(code);
    String s = serializeFormatted(r.getContents().get(0));
    assertEquals("formatting should produce wanted result", expected, s);

  }
View Full Code Here

Examples of org.eclipse.xtext.resource.XtextResource

  }

  @Test
  public void test_CommentShouldBeIndentedOkML() throws Exception {
    String code = "class foo {\n" + "  /* ok comment\n" + "   * ok comment\n" + "   */\n" + "}\n";
    XtextResource r = getResourceFromString(code);
    String s = serializeFormatted(r.getContents().get(0));
    assertEquals("formatting should produce wanted result", code, s);
  }
View Full Code Here

Examples of org.eclipse.xtext.resource.XtextResource

  }

  @Test
  public void test_CommentShouldBeIndentedOkSL() throws Exception {
    String code = "class foo {\n" + "  # ok comment\n" + "  # ok comment\n" + "  #\n" + "}\n";
    XtextResource r = getResourceFromString(code);
    String s = serializeFormatted(r.getContents().get(0));
    assertEquals("formatting should produce wanted result", code, s);
  }
View Full Code Here

Examples of org.eclipse.xtext.resource.XtextResource

  }

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

Examples of org.eclipse.xtext.resource.XtextResource

  }

  @Test
  public void test_CommentShouldNotBeMoved2() throws Exception {
    String code = "$a = 10\n\n# comment\n$b = 20\n";
    XtextResource r = getResourceFromString(code);
    String s = serializeFormatted(r.getContents().get(0));
    assertEquals("formatting should produce same result", code, s);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.