From 031615ac866cc3c8f1900dd4b4aae2106ad31230 Mon Sep 17 00:00:00 2001 From: ipknHama Date: Thu, 7 Aug 2014 01:18:33 +0900 Subject: source resturcturing + CMake --- tests/template/test.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 tests/template/test.py (limited to 'tests/template/test.py') 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') -- cgit v1.2.3-54-g00ecf