Skip to content

Commit

Permalink
Added the start of a test suite.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmolloy committed Mar 30, 2011
1 parent b73c580 commit 1e98648
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/trivial/_global_set.py
@@ -0,0 +1 @@
x = 1
Empty file.
Binary file added tests/trivial/_global_set.pyc
Binary file not shown.
1 change: 1 addition & 0 deletions tests/trivial/_test_print_constant.py
@@ -0,0 +1 @@
print 3
1 change: 1 addition & 0 deletions tests/trivial/_test_print_constant.py.out
@@ -0,0 +1 @@
3
Binary file added tests/trivial/_test_print_constant.pyc
Binary file not shown.
20 changes: 20 additions & 0 deletions tests/trivial/test.py
@@ -0,0 +1,20 @@
#!/bin/env python

import glob, subprocess, difflib, py_compile

for fn in glob.glob("tests/trivial/_*.py"):
py_compile.compile(fn)
try:
out = subprocess.check_output(['build/fastpy', fn + 'c'], stderr=subprocess.STDOUT)
except subprocess.CalledProcessError, e:
out = e.output
with open("%s.out" % fn) as fd:
idealout = fd.read()
if out == idealout:
print "PASS: %s" % fn
else:
d = difflib.Differ()
c = d.compare(idealout.splitlines(), out.splitlines())
print "FAIL: %s" % fn
for line in c:
print line

0 comments on commit 1e98648

Please sign in to comment.