diff options
| author | Tomoyuki Sahara <[email protected]> | 2015-11-24 17:00:12 +0900 |
|---|---|---|
| committer | Tomoyuki Sahara <[email protected]> | 2015-11-24 17:00:12 +0900 |
| commit | 11ffb9385292e7e0144ba78fcc259336437cbe9b (patch) | |
| tree | 3fcc31ac547cef7b5d7276ba035b23a71fd1c77a | |
| parent | ca495944b6d74739e25b324fbcc7d0920fa1bded (diff) | |
| download | mruby-11ffb9385292e7e0144ba78fcc259336437cbe9b.tar.gz mruby-11ffb9385292e7e0144ba78fcc259336437cbe9b.zip | |
assert_nothing_raised is not available on mruby 1.0.0.
| -rw-r--r-- | test/io.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/io.rb b/test/io.rb index a35d7a074..5104b343c 100644 --- a/test/io.rb +++ b/test/io.rb @@ -1,6 +1,26 @@ ## # IO Test +unless Object.respond_to? :assert_nothing_raised + def assert_nothing_raised(*exp) + ret = true + if $mrbtest_assert + $mrbtest_assert_idx += 1 + msg = exp.last.class == String ? exp.pop : "" + begin + yield + rescue Exception => e + msg = "#{msg} exception raised." + diff = " Class: <#{e.class}>\n" + + " Message: #{e.message}" + $mrbtest_assert.push([$mrbtest_assert_idx, msg, diff]) + ret = false + end + end + ret + end +end + assert('IO TEST SETUP') do MRubyIOTestUtil.io_test_setup end |
