Skip to content

Commit

Permalink
ISSUE-305: add a test case
Browse files Browse the repository at this point in the history
  • Loading branch information
spullara committed Jun 27, 2024
1 parent 702606f commit 78dbb3e
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
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);
}
}
1 change: 1 addition & 0 deletions compiler/src/test/resources/dn.mustache
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Mustache Do!
3 changes: 3 additions & 0 deletions compiler/src/test/resources/pd-test.mustache
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Do dynamic names work?

Answer: {{>*name}}

0 comments on commit 78dbb3e

Please sign in to comment.