1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

test_call.rb: refine test_safe_call

* test/ruby/test_call.rb (test_safe_call): rhs should not be
  evaluated when the receiver is nil.  simplified the assertion
  for  [Bug #13964].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60100 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2017-10-02 11:43:36 +00:00
parent 896e7f2d8d
commit 548698397a

View file

@ -50,9 +50,9 @@ class TestCall < Test::Unit::TestCase
o = nil
assert_nil(o&.x)
assert_nothing_raised(NoMethodError) {o&.x = 6}
assert_nothing_raised(NoMethodError) {o&.x *= 7}
assert_nothing_raised(NoMethodError) {o&.x *= 8; [].each {}}
assert_nothing_raised(NoMethodError) {o&.x = raise}
assert_nothing_raised(NoMethodError) {o&.x *= raise}
assert_nothing_raised(NoMethodError) {o&.x *= raise; nil}
end
def test_safe_call_evaluate_arguments_only_method_call_is_made