test_exception - fix with & w/o did_you_mean

See Ruby issue 16263
This commit is contained in:
MSP-Greg 2019-10-19 17:23:18 -05:00 коммит произвёл Nobuyoshi Nakada
Родитель ca7de0334d
Коммит 9223466752
1 изменённых файлов: 5 добавлений и 2 удалений

Просмотреть файл

@ -995,15 +995,18 @@ end.join
error = NoMethodError.new("Message", :foo)
assert_raise(ArgumentError) {error.receiver}
msg = Object.const_defined?(:DidYouMean) ?
"Message\nDid you mean? for" : "Message"
error = NoMethodError.new("Message", :foo, receiver: receiver)
assert_equal(["Message", :foo, receiver],
assert_equal([msg, :foo, receiver],
[error.message, error.name, error.receiver])
error = NoMethodError.new("Message", :foo, [1, 2])
assert_raise(ArgumentError) {error.receiver}
error = NoMethodError.new("Message", :foo, [1, 2], receiver: receiver)
assert_equal(["Message", :foo, [1, 2], receiver],
assert_equal([msg, :foo, [1, 2], receiver],
[error.message, error.name, error.args, error.receiver])
error = NoMethodError.new("Message", :foo, [1, 2], true)