diff options
| author | Yukihiro Matsumoto <[email protected]> | 2012-05-14 23:04:13 +0900 |
|---|---|---|
| committer | Yukihiro Matsumoto <[email protected]> | 2012-05-14 23:04:13 +0900 |
| commit | 8085817cb5737ca0c2a4afb5e3d013a395e12eb4 (patch) | |
| tree | 633371b8956a39b5c570d745bdfa963e42111158 /test/t/_assert.rb | |
| parent | 0c6ff97b8e88e6f848ba73a2bf799de98d27a526 (diff) | |
| download | mruby-8085817cb5737ca0c2a4afb5e3d013a395e12eb4.tar.gz mruby-8085817cb5737ca0c2a4afb5e3d013a395e12eb4.zip | |
make test restructuring
Diffstat (limited to 'test/t/_assert.rb')
| -rw-r--r-- | test/t/_assert.rb | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/test/t/_assert.rb b/test/t/_assert.rb new file mode 100644 index 000000000..91751f769 --- /dev/null +++ b/test/t/_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 |
