aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_call.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby/test_call.rb')
-rw-r--r--test/ruby/test_call.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/ruby/test_call.rb b/test/ruby/test_call.rb
index 5b81eb187a..14b6a6431b 100644
--- a/test/ruby/test_call.rb
+++ b/test/ruby/test_call.rb
@@ -31,4 +31,16 @@ class TestCall < Test::Unit::TestCase
assert_nothing_raised(ArgumentError) {o.foo}
assert_raise_with_message(ArgumentError, e.message, bug9622) {o.foo(100)}
end
+
+ def test_safe_call
+ s = Struct.new(:x, :y)
+ o = s.new("x")
+ assert_equal("X", o.x.?upcase)
+ assert_nil(o.y.?upcase)
+ assert_equal("x", o.x)
+ o.?x = 6
+ assert_equal(6, o.x)
+ o.?x *= 7
+ assert_equal(42, o.x)
+ end
end