diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-12-13 09:17:55 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-12-13 09:17:55 +0000 |
commit | 287d2adab0ce45018ada9941ce4eaf67ba6a4d3a (patch) | |
tree | 066ef758e9e417f69e059a5819ce7f5689f754a5 /test/ruby | |
parent | 3ba2006aa443b45aba41d4a6bc8fa82505def4d3 (diff) | |
download | ruby-287d2adab0ce45018ada9941ce4eaf67ba6a4d3a.tar.gz |
assertions.rb: last match in assert_raise_with_message
* lib/test/unit/assertions.rb (assert_raise_with_message): set
caller's last match if expected is a Regexp.
* test/ruby/test_arity.rb (err_mess): use assert_raise_with_message.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44172 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_arity.rb | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/test/ruby/test_arity.rb b/test/ruby/test_arity.rb index 18ef9b2d03..e026841749 100644 --- a/test/ruby/test_arity.rb +++ b/test/ruby/test_arity.rb @@ -3,7 +3,7 @@ require 'test/unit' class TestArity < Test::Unit::TestCase def err_mess(method_proc = nil, argc = 0) args = (1..argc).to_a - err = assert_raise(ArgumentError) do + assert_raise_with_message(ArgumentError, /wrong number of arguments \((.*)\)/) do case method_proc when nil yield @@ -13,8 +13,6 @@ class TestArity < Test::Unit::TestCase method_proc.call(*args) end end - s = err.to_s - assert s =~ /wrong number of arguments \((.*)\)/, "Unexpected ArgumentError's message: #{s}" $1 end |