diff options
author | ipknHama <ipknhama@gmail.com> | 2014-08-08 03:53:36 +0900 |
---|---|---|
committer | ipknHama <ipknhama@gmail.com> | 2014-08-08 03:53:36 +0900 |
commit | 3018ff063acb747065adea877e3e2ac9423f5233 (patch) | |
tree | 110f1a6596242b7837c16f88b4838d6fd93dc93c /tests/template/test.py | |
parent | a0c93f5b84cc11b30bc6320ac26127832ef8bf7a (diff) | |
parent | 001c66b378d200bdecc8a4a692c5a73a7d426b8f (diff) | |
download | crow-3018ff063acb747065adea877e3e2ac9423f5233.tar.gz crow-3018ff063acb747065adea877e3e2ac9423f5233.zip |
Merge branch 'directory-restructuring'
Directory structure changed.
Crow becomes a complete header-only library with http_parser_merged.h.
Provides amalgamated crow_all.h (all feature in one header file).
Diffstat (limited to 'tests/template/test.py')
-rwxr-xr-x | tests/template/test.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/template/test.py b/tests/template/test.py new file mode 100755 index 0000000..57bcaf8 --- /dev/null +++ b/tests/template/test.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python +from __future__ import print_function +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").decode('utf8') + 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') |