Permalink
Browse files

Merge pull request #90 from nixon/fix_tests

fix testcases
  • Loading branch information...
2 parents 56e807c + 9bc9b3d commit 4cd378774f290f3becf2d61718291b4cec97c8f7 @faceleg faceleg committed Jan 15, 2014
Showing with 8 additions and 3 deletions.
  1. +8 −3 sparkup-unittest.py
View
@@ -45,11 +45,11 @@ class SparkupTest:
},
'Shortcut test': {
'input': 'input:button',
- 'output': '<input type="button" class="button" value="$1" name="$2" />$0'
+ 'output': '<input type="button" class="button" value="$1" name="$2">$0'
},
'Shortcut synonym test': {
'input': 'button',
- 'output': '<input type="button" class="button" value="$1" name="$2" />$0'
+ 'output': '<button>$1</button>$0',
},
'Child test': {
'input': 'div>ul>li',
@@ -113,8 +113,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():
@@ -137,6 +139,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('"', '\"')
@@ -145,6 +148,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 4cd3787

Please sign in to comment.