Skip to content

Successful test prints error #316

@mike-lischke

Description

@mike-lischke

Not sure if that is intended, but the test testFullyQualifiedTemplateRef2 in TestTemplateNames.java prints an error to the console, even though it succeeds. The message is:

context [/group/c] 1:1 passed 0 arg(s) to template /a with 1 declared arg(s)

which is clear given that the /a template expects a parameter, which is not specfied:

    @Test public void testFullyQualifiedTemplateRef2() throws Exception {
        // /randomdir/a and /randomdir/group.stg with b and c templates
        String dir = getRandomDir();
        writeFile(dir, "a.st", "a(x) ::= << </group/b()> >>\n");
        String groupFile =
            "b() ::= \"bar\"\n"+
            "c() ::= \"</a()>\"\n";
        writeFile(dir, "group.stg", groupFile);
        STGroup group = new STGroupDir(dir);
        ST st1 = group.getInstanceOf("/a");
        ST st2 = group.getInstanceOf("/group/c"); // invokes /a
        String expected = " bar  bar ";
        String result = st1.render()+st2.render();
        assertEquals(expected, result);
    }

So I wonder if that is just an oversight and nobody ever cared for it or if that is used in some way outside of this test?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions