Package org.stringtemplate.v4

Examples of org.stringtemplate.v4.ST.render()


            );
        e.add("mine", new int[] { 1, 2, 3 });
        e.add("yours", "a");
        e.add("yours", "b");
        String expecting = "1, b";
        assertEquals(expecting, e.render());
    }

    @Test public void testCatListAndSingleAttribute() throws Exception {
        // replace first of yours with first of mine
        org.stringtemplate.v4.ST e = new org.stringtemplate.v4.ST(
View Full Code Here


                "<[mine,yours]; separator=\", \">"
            );
        e.add("mine", Arrays.asList("1", "2", "3"));
        e.add("yours", "a");
        String expecting = "1, 2, 3, a";
        assertEquals(expecting, e.render());
    }

    @Test public void testCatArrayAndSingleAttribute() throws Exception {
        // replace first of yours with first of mine
        ST e = new ST(
View Full Code Here

                "<[mine,yours]; separator=\", \">"
            );
        e.add("mine", new String[] { "1", "2", "3" });
        e.add("yours", "a");
        String expecting = "1, 2, 3, a";
        assertEquals(expecting, e.render());
    }

    @Test public void testCatPrimitiveArrayAndSingleAttribute() throws Exception {
        // replace first of yours with first of mine
        ST e = new ST(
View Full Code Here

                "<[mine,yours]; separator=\", \">"
            );
        e.add("mine", new int[] { 1, 2, 3 });
        e.add("yours", "a");
        String expecting = "1, 2, 3, a";
        assertEquals(expecting, e.render());
    }

    @Test public void testReUseOfCat() throws Exception {
        String templates =
            "a(mine,yours) ::= \"<b([mine,yours])>\""+newline+
View Full Code Here

                "<[x,mine,y,yours,z]; separator=\", \">"
            );
        e.add("mine", Arrays.asList("1", "2", "3"));
        e.add("yours", "a");
        String expecting = "1, 2, 3, a";
        assertEquals(expecting, e.render());
    }

    @Test public void testCatArrayAndEmptyAttributes2() throws Exception {
        // + is overloaded to be cat strings and cat lists so the
        // two operands (from left to right) determine which way it
View Full Code Here

                "<[x,mine,y,yours,z]; separator=\", \">"
            );
        e.add("mine", new String[] { "1", "2", "3" });
        e.add("yours", "a");
        String expecting = "1, 2, 3, a";
        assertEquals(expecting, e.render());
    }

    @Test public void testCatPrimitiveArrayAndEmptyAttributes() throws Exception {
        // + is overloaded to be cat strings and cat lists so the
        // two operands (from left to right) determine which way it
View Full Code Here

                "<[x,mine,y,yours,z]; separator=\", \">"
            );
        e.add("mine", new int[] { 1, 2, 3 });
        e.add("yours", "a");
        String expecting = "1, 2, 3, a";
        assertEquals(expecting, e.render());
    }

    @Test public void testNestedOp() throws Exception {
        ST e = new org.stringtemplate.v4.ST(
                "<first(rest(names))>" // gets 2nd element
View Full Code Here

            );
        e.add("names", "Ter");
        e.add("names", "Tom");
        e.add("names", "Sriram");
        String expecting = "Tom";
        assertEquals(expecting, e.render());
    }

    @Test public void testNestedOpList() throws Exception {
        ST e = new ST(
                "<first(rest(names))>" // gets 2nd element
View Full Code Here

        ST e = new ST(
                "<first(rest(names))>" // gets 2nd element
            );
        e.add("names", Arrays.asList("Ter", "Tom", "Sriram"));
        String expecting = "Tom";
        assertEquals(expecting, e.render());
    }

    @Test public void testNestedOpArray() throws Exception {
        ST e = new ST(
                "<first(rest(names))>" // gets 2nd element
View Full Code Here

        ST e = new ST(
                "<first(rest(names))>" // gets 2nd element
            );
        e.add("names", new String[] { "Ter", "Tom", "Sriram" });
        String expecting = "Tom";
        assertEquals(expecting, e.render());
    }

    @Test public void testNestedOpPrimitiveArray() throws Exception {
        ST e = new ST(
                "<first(rest(names))>" // gets 2nd element
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.