diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2021-11-21 00:31:51 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2021-11-21 00:31:51 +0900 |
commit | 8f3432cd4466c35cd9f482de3779d76f3957968f (patch) | |
tree | 18ebb49c357a05646bef52e4b5c2ef52b2460d6f /test/ruby/test_struct.rb | |
parent | c5ec05d047f3c3f32b34d705088d407429d4303a (diff) | |
download | ruby-8f3432cd4466c35cd9f482de3779d76f3957968f.tar.gz |
Fix setting struct member by public_send
Diffstat (limited to 'test/ruby/test_struct.rb')
-rw-r--r-- | test/ruby/test_struct.rb | 8 |
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 |