summaryrefslogtreecommitdiff
path: root/test/ostruct/test_ostruct.rb
diff options
context:
space:
mode:
authorLadislav Gallay <ladislav.gallay@lentil.sk>2022-01-18 14:54:52 +0100
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2022-03-07 20:08:22 +0900
commite1391bf96f03143387c500a168adb6fc9fc242c6 (patch)
treeb4fbbe791e892d4f039396511ec159b0538860ab /test/ostruct/test_ostruct.rb
parent1dd2d2ce48d7ed0e16beb42ac923ccd069701958 (diff)
[ruby/ostruct] Fix class and method as attribute names
https://github.com/ruby/ostruct/commit/7258535073
Diffstat (limited to 'test/ostruct/test_ostruct.rb')
-rw-r--r--test/ostruct/test_ostruct.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/ostruct/test_ostruct.rb b/test/ostruct/test_ostruct.rb
index 6487cc831c..256db7a0c7 100644
--- a/test/ostruct/test_ostruct.rb
+++ b/test/ostruct/test_ostruct.rb
@@ -406,4 +406,10 @@ class TC_OpenStruct < Test::Unit::TestCase
o2 = Marshal.load(Marshal.dump(o))
assert_equal o, o2
end
+
+ def test_class
+ os = OpenStruct.new(class: 'my-class', method: 'post')
+ assert_equal('my-class', os.class)
+ assert_equal(OpenStruct, os.class!)
+ end
end