Examples of STGroupFile


Examples of org.stringtemplate.v4.STGroupFile

    @Test public void testErrorInNestedTemplate() throws Exception {
        String templates =
            "foo() ::= \"hi <name:{[<aaa.bb!>]}> mom\"\n";
        writeFile(tmpdir, "t.stg", templates);

    STGroupFile group = null;
    STErrorListener errors = new ErrorBuffer();
    group = new STGroupFile(tmpdir+"/"+"t.stg");
    group.setListener(errors);
    group.load(); // force load
    String expected = "t.stg 1:29: '!' came as a complete surprise to me"+newline;
    String result = errors.toString();
    assertEquals(expected, result);
  }
View Full Code Here

Examples of org.stringtemplate.v4.STGroupFile

  @Test public void testEOFInExpr() throws Exception {
    String templates =
      "foo() ::= \"hi <name\"";
    writeFile(tmpdir, "t.stg", templates);

    STGroupFile group = null;
    STErrorListener errors = new ErrorBuffer();
    group = new STGroupFile(tmpdir+"/"+"t.stg");
    group.setListener(errors);
    group.load(); // force load
    String expected = "t.stg 1:19: premature EOF"+newline;
    String result = errors.toString();
    assertEquals(expected, result);
  }
View Full Code Here

Examples of org.stringtemplate.v4.STGroupFile

  @Test public void testEOFInExpr2() throws Exception {
    String templates =
      "foo() ::= \"hi <name:{x|[<aaa.bb>]}\"\n";
    writeFile(tmpdir, "t.stg", templates);

    STGroupFile group = null;
    STErrorListener errors = new ErrorBuffer();
    group = new STGroupFile(tmpdir+"/"+"t.stg");
    group.setListener(errors);
    group.load(); // force load
    String expected = "t.stg 1:34: premature EOF"+newline;
    String result = errors.toString();
    assertEquals(expected, result);
  }
View Full Code Here

Examples of org.stringtemplate.v4.STGroupFile

  @Test public void testEOFInString() throws Exception {
    String templates =
      "foo() ::= << <f(\"foo>>\n";
    writeFile(tmpdir, "t.stg", templates);

    STGroupFile group = null;
    STErrorListener errors = new ErrorBuffer();
    group = new STGroupFile(tmpdir+"/"+"t.stg");
    group.setListener(errors);
    group.load(); // force load
    String expected = "t.stg 1:20: EOF in string"+newline +
              "t.stg 1:20: premature EOF"+newline;
    String result = errors.toString();
    assertEquals(expected, result);
  }
View Full Code Here

Examples of org.stringtemplate.v4.STGroupFile

  @Test public void testNonterminatedComment() throws Exception {
    String templates =
      "foo() ::= << <!foo> >>";
    writeFile(tmpdir, "t.stg", templates);

    STGroupFile group = null;
    STErrorListener errors = new ErrorBuffer();
    group = new STGroupFile(tmpdir+"/"+"t.stg");
    group.setListener(errors);
    group.load(); // force load
    String expected =
      "t.stg 1:20: Nonterminated comment starting at 1:1: '!>' missing" +newline;
    String result = errors.toString();
    assertEquals(expected, result);
  }
View Full Code Here

Examples of org.stringtemplate.v4.STGroupFile

  @Test public void testMissingRPAREN() throws Exception {
    String templates =
      "foo() ::= \"hi <foo(>\"\n";
    writeFile(tmpdir, "t.stg", templates);

    STGroupFile group = null;
    STErrorListener errors = new ErrorBuffer();
    group = new STGroupFile(tmpdir+"/"+"t.stg");
    group.setListener(errors);
    group.load(); // force load
    String expected = "t.stg 1:19: '>' came as a complete surprise to me"+newline;
    String result = errors.toString();
    assertEquals(expected, result);
  }
View Full Code Here

Examples of org.stringtemplate.v4.STGroupFile

  @Test public void testRotPar() throws Exception {
    String templates =
      "foo() ::= \"<a,b:t(),u()>\"\n";
    writeFile(tmpdir, "t.stg", templates);

    STGroupFile group = null;
    STErrorListener errors = new ErrorBuffer();
    group = new STGroupFile(tmpdir+"/"+"t.stg");
    group.setListener(errors);
    group.load(); // force load
    String expected = "t.stg 1:19: mismatched input ',' expecting RDELIM"+newline;
    String result = errors.toString();
    assertEquals(expected, result);
  }
View Full Code Here

Examples of org.stringtemplate.v4.STGroupFile

    @Test public void testSetUnknownAttr() throws Exception {
        String templates =
            "t() ::= <<hi <name>!>>\n";
        ErrorBuffer errors = new ErrorBuffer();
        writeFile(tmpdir, "t.stg", templates);
        STGroup group = new STGroupFile(tmpdir+"/"+"t.stg");
    group.setListener(errors);
        ST st = group.getInstanceOf("t");
        String result = null;
    try {
      st.add("name", "Ter");
    }
    catch (IllegalArgumentException iae) {
View Full Code Here

Examples of org.stringtemplate.v4.STGroupFile

        String templates =
            "d ::= [\"foo\":\"bold\"]\n" +
            "test(name) ::= \"<name:(d.foo)()>\"\n" +
            "bold(x) ::= <<*<x>*>>\n";
        writeFile(tmpdir, "t.stg", templates);
        STGroup group = new STGroupFile(tmpdir+"/"+"t.stg");
        ST st = group.getInstanceOf("test");
        st.add("name", "Ter");
        st.add("name", "Tom");
        st.add("name", "Sumana");
        String expected = "*Ter**Tom**Sumana*";
        String result = st.render();
View Full Code Here

Examples of org.stringtemplate.v4.STGroupFile

      "foo" +newline+
      "    <if(scope)>oops<endif>" +newline+
      "bar" +newline+
      ">>";
    writeFile(dir, "group.stg", groupFile);
    STGroupFile group = new STGroupFile(dir+"/group.stg");
    ST st = group.getInstanceOf("a");
    st.impl.dump();
    String expected = "foo" +newline+
      "bar";
    String result = st.render();
    assertEquals(expected, result);
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.