summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_struct.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/ruby/test_struct.rb b/test/ruby/test_struct.rb
index 677452879c..1bcc485410 100644
--- a/test/ruby/test_struct.rb
+++ b/test/ruby/test_struct.rb
@@ -131,7 +131,15 @@ class TestStruct < Test::Unit::TestCase
klass = Struct.new(:@a)
o = klass.new(1)
+ assert_equal(1, o.__send__(:@a))
assert_equal("#<struct :@a=1>", o.inspect)
+ o.__send__(:"@a=", 2)
+ assert_equal(2, o.__send__(:@a))
+ assert_equal("#<struct :@a=2>", o.inspect)
+ o.__send__("@a=", 3)
+ assert_equal(3, o.__send__(:@a))
+ assert_equal("#<struct :@a=3>", o.inspect)
+
methods = klass.instance_methods(false)
assert_equal([:@a, :"@a="].inspect, methods.inspect, '[Bug #8756]')
assert_include(methods, :@a)