summaryrefslogtreecommitdiff
path: root/test/lib
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-11-02 12:29:33 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-11-02 12:29:33 +0000
commitfe1ad67c28492e32b469bd24b6722588c3f6f7bc (patch)
treef588b2b8a39b4c9c38a6709a4d8da54fcaaaadee /test/lib
parentd49fca8894d05d124277f6be448994f3f7ccdcc6 (diff)
downloadruby-fe1ad67c28492e32b469bd24b6722588c3f6f7bc.tar.gz
assertions.rb: fix return in assert_raise
* test/lib/test/unit/assertions.rb (assert_raise): should fail if returned gently in the given block without any exceptions. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60614 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/lib')
-rw-r--r--test/lib/test/unit/assertions.rb10
1 files changed, 6 insertions, 4 deletions
diff --git a/test/lib/test/unit/assertions.rb b/test/lib/test/unit/assertions.rb
index d23cd7220b..fda2299eb0 100644
--- a/test/lib/test/unit/assertions.rb
+++ b/test/lib/test/unit/assertions.rb
@@ -89,11 +89,13 @@ module Test
}
return e
- end
-
- exp = exp.first if exp.size == 1
+ ensure
+ unless e
+ exp = exp.first if exp.size == 1
- flunk(message(msg) {"#{mu_pp(exp)} expected but nothing was raised"})
+ flunk(message(msg) {"#{mu_pp(exp)} expected but nothing was raised"})
+ end
+ end
end
def assert_raises(*exp, &b)