-
Notifications
You must be signed in to change notification settings - Fork 285
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
compiler/src/test/java/com/github/mustachejava/DynamicNamesTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.github.mustachejava; | ||
|
||
import org.junit.Test; | ||
|
||
import java.io.StringWriter; | ||
import java.util.Map; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
public class DynamicNamesTest { | ||
|
||
@Test | ||
public void testIssue305() { | ||
MustacheFactory mf = new DefaultMustacheFactory(); | ||
Mustache m = mf.compile("pd-test.mustache"); | ||
|
||
StringWriter writer = new StringWriter(); | ||
|
||
Map<String, String> scope = new java.util.HashMap<>(); | ||
scope.put("name", "dn"); | ||
m.execute(writer, scope); | ||
|
||
String result = writer.toString(); | ||
|
||
assertEquals("Do dynamic names work?\n" + | ||
"\n" + | ||
"Answer: Mustache Do!", result); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Mustache Do! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Do dynamic names work? | ||
|
||
Answer: {{>*name}} |