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 /template_test/test.py | |
parent | e68f5db64fc2e2f54184d3eef446520a2c2379f9 (diff) | |
download | crow-2e8f9f383d3ebc78fb2cb8ad37ad855ac28d11dd.tar.gz crow-2e8f9f383d3ebc78fb2cb8ad37ad855ac28d11dd.zip |
begin implementation: mustache based template engine
Diffstat (limited to 'template_test/test.py')
-rwxr-xr-x | template_test/test.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/template_test/test.py b/template_test/test.py new file mode 100755 index 0000000..b492396 --- /dev/null +++ b/template_test/test.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python +import glob +import json +import os +import subprocess +for testfile in glob.glob("*.json"): + testdoc = json.load(open(testfile)) + for test in testdoc["tests"]: + if "partials" in test: + continue + if "partial" in test: + continue + if "lambda" in test["data"]: + continue + print testfile, test["name"] + print json.dumps(test["data"]) + print test["template"] + open('data', 'w').write(json.dumps(test["data"])) + open('template', 'w').write(test["template"]) + ret = subprocess.check_output("./mustachetest") + if ret != test["expected"]: + print 'Expected:',(test["expected"]) + print 'Actual:',(ret) + os.unlink('data') + os.unlink('template') + assert ret == test["expected"] |