Merge pull request #140 from ralfs-gutmanis/master

Add ability to pass CharSequence instead of forcing String for contex…
This commit is contained in:
Michael Bayne
2023-11-15 09:52:14 -08:00
committed by GitHub
4 changed files with 35 additions and 8 deletions
@@ -17,9 +17,6 @@ import java.util.Optional;
import java.util.TimeZone;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
/**
* Mustache tests that can only be run on the JVM. Most tests should go in BaseMustacheTest so
@@ -54,6 +51,14 @@ public class MustacheTest extends SharedTests
});
}
@Test public void testCharSequenceVariable() {
Map<String, CharSequence> ctx = new HashMap<>();
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append("bar");
ctx.put("foo", stringBuffer);
test("bar", "{{foo}}", ctx);
}
public interface HasDefault {
default String getFoo () { return "bar"; }
}