* test/ruby/test_arity.rb (TestArity#err_mess): use assert_raise.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35026 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
724e683e86
commit
9f9201b85d
@ -1,3 +1,7 @@
|
|||||||
|
Thu Mar 15 10:31:40 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* test/ruby/test_arity.rb (TestArity#err_mess): use assert_raise.
|
||||||
|
|
||||||
Thu Mar 15 07:03:52 2012 Eric Hodel <drbrain@segment7.net>
|
Thu Mar 15 07:03:52 2012 Eric Hodel <drbrain@segment7.net>
|
||||||
|
|
||||||
* vm_eval.c (check_funcall): Raise ArgumentError if respond_to?
|
* vm_eval.c (check_funcall): Raise ArgumentError if respond_to?
|
||||||
|
@ -3,16 +3,16 @@ require 'test/unit'
|
|||||||
class TestArity < Test::Unit::TestCase
|
class TestArity < Test::Unit::TestCase
|
||||||
def err_mess(method_proc = nil, argc = 0)
|
def err_mess(method_proc = nil, argc = 0)
|
||||||
args = (1..argc).to_a
|
args = (1..argc).to_a
|
||||||
case method_proc
|
err = assert_raise(ArgumentError) do
|
||||||
|
case method_proc
|
||||||
when nil
|
when nil
|
||||||
yield
|
yield
|
||||||
when Symbol
|
when Symbol
|
||||||
method(method_proc).call(*args)
|
method(method_proc).call(*args)
|
||||||
else
|
else
|
||||||
method_proc.call(*args)
|
method_proc.call(*args)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
fail "Expected ArgumentError to be raised"
|
|
||||||
rescue ArgumentError => err
|
|
||||||
s = err.to_s
|
s = err.to_s
|
||||||
assert s =~ /wrong number of arguments \((.*)\)/, "Unexpected ArgumentError's message: #{s}"
|
assert s =~ /wrong number of arguments \((.*)\)/, "Unexpected ArgumentError's message: #{s}"
|
||||||
$1
|
$1
|
||||||
|
@ -471,11 +471,11 @@ class TestObject < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
e = assert_raises(ArgumentError, '[bug:6000]') do
|
e = assert_raise(ArgumentError, '[bug:6000]') do
|
||||||
[[p]].flatten
|
[[p]].flatten
|
||||||
end
|
end
|
||||||
|
|
||||||
assert_equal('respond_to? must accept 1 or 2 arguments (requires 3)', e.message)
|
assert_equal('respond_to? must accept 1 or 2 arguments (requires 3)', e.message)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_method_missing_passed_block
|
def test_method_missing_passed_block
|
||||||
|
@ -7,7 +7,7 @@ require 'tmpdir'
|
|||||||
class TestRequire < Test::Unit::TestCase
|
class TestRequire < Test::Unit::TestCase
|
||||||
def test_load_error_path
|
def test_load_error_path
|
||||||
filename = "should_not_exist"
|
filename = "should_not_exist"
|
||||||
error = assert_raises(LoadError) do
|
error = assert_raise(LoadError) do
|
||||||
require filename
|
require filename
|
||||||
end
|
end
|
||||||
assert_equal filename, error.path
|
assert_equal filename, error.path
|
||||||
|
@ -137,7 +137,7 @@ class TestThread < Test::Unit::TestCase
|
|||||||
# mutex = Mutex.new
|
# mutex = Mutex.new
|
||||||
# cv = ConditionVariable.new
|
# cv = ConditionVariable.new
|
||||||
#
|
#
|
||||||
# assert_raises(fatal) {
|
# assert_raise(fatal) {
|
||||||
# mutex.lock
|
# mutex.lock
|
||||||
# cv.wait mutex
|
# cv.wait mutex
|
||||||
# mutex.unlock
|
# mutex.unlock
|
||||||
|
Loading…
x
Reference in New Issue
Block a user