summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2021-11-21 00:31:51 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2021-11-21 00:31:51 +0900
commit8f3432cd4466c35cd9f482de3779d76f3957968f (patch)
tree18ebb49c357a05646bef52e4b5c2ef52b2460d6f /test/ruby
parentc5ec05d047f3c3f32b34d705088d407429d4303a (diff)
Fix setting struct member by public_send
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/5152
Diffstat (limited to 'test/ruby')
-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 19577266c7..0301612395 100644
--- a/test/ruby/test_struct.rb
+++ b/test/ruby/test_struct.rb
@@ -489,6 +489,14 @@ module TestStruct
}
end
+ def test_public_send
+ klass = @Struct.new(:a)
+ x = klass.new(1)
+ assert_equal(1, x.public_send("a"))
+ assert_equal(42, x.public_send("a=", 42))
+ assert_equal(42, x.public_send("a"))
+ end
+
class TopStruct < Test::Unit::TestCase
include TestStruct