aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_struct.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby/test_struct.rb')
-rw-r--r--test/ruby/test_struct.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/ruby/test_struct.rb b/test/ruby/test_struct.rb
index d769e47dc5..b3191902a3 100644
--- a/test/ruby/test_struct.rb
+++ b/test/ruby/test_struct.rb
@@ -263,4 +263,10 @@ class TestStruct < Test::Unit::TestCase
end
assert_equal("Insecure: can't modify #{st}::S", error.message, bug5036)
end
+
+ def test_to_h
+ klass = Struct.new(:a, :b, :c, :d, :e, :f)
+ o = klass.new(1, 2, 3, 4, 5, 6)
+ assert_equal({a:1, b:2, c:3, d:4, e:5, f:6}, o.to_h)
+ end
end