antlr / antlr/stringtemplate4

Successful test prints error

Open
#316 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
1k
Forks
234
PR merge metrics
No merged PRs in 30d

Description

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:

```java
@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) ::= << >>\n");
String groupFile =
"b() ::= \"bar\"\n"+
"c() ::= \"\"\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?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.