Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Successful test prints error #316

Open
mike-lischke opened this issue Jan 1, 2024 · 0 comments
Open

Successful test prints error #316

mike-lischke opened this issue Jan 1, 2024 · 0 comments

Comments

@mike-lischke
Copy link
Member

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?

@mike-lischke mike-lischke changed the title Successful tests prints error Successful test prints error Jan 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant