Permalink
Browse files

return number of testcase failures

allow `git bisect` to know whether or not all tests passed.
  • Loading branch information...
1 parent bb70843 commit 701031991fde7f9af4ce77e8f5ab1a1bf7ca47fd @nixon nixon committed Dec 20, 2013
Showing with 6 additions and 1 deletion.
  1. +6 −1 sparkup-unittest.py
View
@@ -105,8 +105,10 @@ class SparkupTest:
},
# Add: text test, broken test, multi-attribute tests, indentation test, start and end comments test
}
+
def run(self):
"""Run Forrest run!"""
+ failures = 0
print "Test results:"
for name, case in self.cases.iteritems():
@@ -129,6 +131,7 @@ def run(self):
print " - %-30s [%s]" % (name, result_str)
if not result:
+ failures += 1
print "= %s" % input.replace("\n", "\n= ")
print "Actual output (condensed):"
print " | '%s'" % output.replace("\n", r"\n").replace('"', '\"')
@@ -137,6 +140,8 @@ def run(self):
print "Expected:"
print " | %s" % case['output'].replace("\n", "\ n| ")
+ return failures
+
if __name__ == '__main__':
s = SparkupTest()
- s.run()
+ sys.exit(s.run())

0 comments on commit 7010319

Please sign in to comment.