mirror of
https://github.com/CrowCpp/Crow.git
synced 2024-06-07 21:10:44 +00:00
17034adae5
general tests are now enabled on MSVC, mustachetests disabled due to some strange bug in python script (will be done later)
39 lines
1.2 KiB
Python
Executable File
39 lines
1.2 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
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("{}")
|
|
|
|
if os.name == 'nt':
|
|
ret = subprocess.check_output("mustachetest.exe").decode('utf8')
|
|
else:
|
|
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('Data: ', json.dumps(test["data"]))
|
|
print('Template: ', test["template"])
|
|
print('Expected:', repr(test["expected"]))
|
|
print('Actual:', repr(ret))
|
|
assert ret == test["expected"]
|
|
|
|
os.unlink('data')
|
|
os.unlink('template')
|
|
os.unlink('partials')
|