mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* test/ruby/test_call.rb: added test for safe navigation operator.
[fix GH-1066] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52383 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
8af123076e
commit
a2845a44ff
2 changed files with 18 additions and 0 deletions
|
@ -1,3 +1,8 @@
|
|||
Fri Oct 30 12:53:21 2015 yui-knk <spiketeika@gmail.com>
|
||||
|
||||
* test/ruby/test_call.rb: added test for safe navigation operator.
|
||||
[fix GH-1066]
|
||||
|
||||
Fri Oct 30 12:47:34 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org>
|
||||
|
||||
* ChangeLog: fix wrong commit name.
|
||||
|
|
|
@ -52,4 +52,17 @@ class TestCall < Test::Unit::TestCase
|
|||
assert_nothing_raised(NoMethodError) {o.?x = 6}
|
||||
assert_nothing_raised(NoMethodError) {o.?x *= 7}
|
||||
end
|
||||
|
||||
def test_safe_call_evaluate_arguments_only_method_call_is_made
|
||||
count = 0
|
||||
proc = proc { count += 1; 1 }
|
||||
s = Struct.new(:x, :y)
|
||||
o = s.new(["a", "b", "c"])
|
||||
|
||||
o.y.?at(proc.call)
|
||||
assert_equal(0, count)
|
||||
|
||||
o.x.?at(proc.call)
|
||||
assert_equal(1, count)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue