aboutsummaryrefslogtreecommitdiffstats
path: root/tests/template/test.py
diff options
context:
space:
mode:
authoripknHama <ipknhama@gmail.com>2014-08-07 01:18:33 +0900
committeripknHama <ipknhama@gmail.com>2014-08-07 01:18:33 +0900
commit031615ac866cc3c8f1900dd4b4aae2106ad31230 (patch)
treeb8b7206ffbd2043368580ec269c97436929fe452 /tests/template/test.py
parenta0c93f5b84cc11b30bc6320ac26127832ef8bf7a (diff)
downloadcrow-031615ac866cc3c8f1900dd4b4aae2106ad31230.tar.gz
crow-031615ac866cc3c8f1900dd4b4aae2106ad31230.zip
source resturcturing + CMake
Diffstat (limited to 'tests/template/test.py')
-rwxr-xr-xtests/template/test.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/template/test.py b/tests/template/test.py
new file mode 100755
index 0000000..22fcca0
--- /dev/null
+++ b/tests/template/test.py
@@ -0,0 +1,29 @@
+#!/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 "lambda" in test["data"]:
+ continue
+ open('data', 'w').write(json.dumps(test["data"]))
+ open('template', 'w').write(test["template"])
+ if "partials" in test:
+ open('partials', 'w').write(json.dumps(test["partials"]))
+ else:
+ open('partials', 'w').write("{}")
+ ret = subprocess.check_output("./mustachetest")
+ print testfile, test["name"]
+ if ret != test["expected"]:
+ if 'partials' in test:
+ print 'partials:', json.dumps(test["partials"])
+ print json.dumps(test["data"])
+ print test["template"]
+ print 'Expected:',repr(test["expected"])
+ print 'Actual:',repr(ret)
+ assert ret == test["expected"]
+ os.unlink('data')
+ os.unlink('template')
+ os.unlink('partials')