diff options
author | ipknHama <ipknhama@gmail.com> | 2014-07-31 00:50:38 +0900 |
---|---|---|
committer | ipknHama <ipknhama@gmail.com> | 2014-08-02 22:32:48 +0900 |
commit | 2e8f9f383d3ebc78fb2cb8ad37ad855ac28d11dd (patch) | |
tree | 43a9aa78cde60fe55fde5735f40dae7c34405df8 /unittest.cpp | |
parent | e68f5db64fc2e2f54184d3eef446520a2c2379f9 (diff) | |
download | crow-2e8f9f383d3ebc78fb2cb8ad37ad855ac28d11dd.tar.gz crow-2e8f9f383d3ebc78fb2cb8ad37ad855ac28d11dd.zip |
begin implementation: mustache based template engine
Diffstat (limited to 'unittest.cpp')
-rw-r--r-- | unittest.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/unittest.cpp b/unittest.cpp index 718d3d2..680bf50 100644 --- a/unittest.cpp +++ b/unittest.cpp @@ -6,6 +6,7 @@ #include "utility.h" #include "crow.h" #include "json.h" +#include "mustache.h" using namespace std; using namespace crow; @@ -380,6 +381,16 @@ TEST(json_write) ASSERT_EQUAL(R"({"scores":{"a":{"b":{"c":null}}}})", json::dump(y)); } +TEST(template_basic) +{ + auto t = crow::mustache::compile(R"---(attack of {{name}})---"); + crow::mustache::context ctx; + ctx["name"] = "killer tomatoes"; + auto result = t.render(ctx); + ASSERT_EQUAL("attack of killer tomatoes", result); + //crow::mustache::load("basic.mustache"); +} + int testmain() { bool failed = false; |