diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2012-05-14 06:15:42 -0700 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2012-05-14 06:15:42 -0700 |
| commit | bcb743fccba0628362e284515edade211dd55e19 (patch) | |
| tree | a29397364f5c6f05b2f1bdd24af5f13a6472a6f7 /test/_assert.rb | |
| parent | 6b67801d4e643583746da41a74218145236b8f9d (diff) | |
| parent | c82a518ee1df250a03abb82aa58a1bfd2c04cfc3 (diff) | |
| download | mruby-bcb743fccba0628362e284515edade211dd55e19.tar.gz mruby-bcb743fccba0628362e284515edade211dd55e19.zip | |
Merge pull request #131 from bovi/master
mrit - Embeddable Ruby ISO Test
Diffstat (limited to 'test/_assert.rb')
| -rw-r--r-- | test/_assert.rb | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/test/_assert.rb b/test/_assert.rb new file mode 100644 index 000000000..91751f769 --- /dev/null +++ b/test/_assert.rb @@ -0,0 +1,44 @@ +$ok_test = 0 +$ko_test = 0 +$asserts = [] + +## +# Verify a code block. +# +# str : A remark which will be printed in case +# this assertion fails +# iso : The ISO reference code of the feature +# which will be tested by this +# assertion +def assert(str = 'Assertion failed', iso = '') + if(!yield) + $asserts.push([str, iso]) + $ko_test += 1 + print "F" + else + $ok_test += 1 + print "." + end +end + +## +# Report the test result and print all assertions +# which were reported broken. +def report() + print "\n" + $asserts.each do |str, iso| + print("Test Failed: #{str} [#{iso}]\n"); + end + + $total_test = $ok_test + $ko_test + print 'Total tests:' + print $total_test + print "\n" + + print ' OK: ' + print $ok_test + print "\n" + print ' KO: ' + print $ko_test + print "\n" +end |
