1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* struct.c (make_struct): remove junk ID check to allow members who

have junk name like "foo\000".
* test/ruby/test_struct.rb: Test for above.
  [Bug #7575] [ruby-dev:46750]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38547 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
glass 2012-12-22 02:52:48 +00:00
parent 570b766901
commit f9e621372d
3 changed files with 20 additions and 8 deletions

View file

@ -227,6 +227,13 @@ class TestStruct < Test::Unit::TestCase
assert_equal("#<struct Struct::R\u{e9}sum\u{e9} r\u{e9}sum\u{e9}=42>", a.inspect, '[ruby-core:24849]')
end
def test_junk
struct_test = Struct.new("Foo", "a\000")
o = struct_test.new(1)
assert_equal(1, o.send("a\000"))
Struct.instance_eval { remove_const(:Foo) }
end
def test_comparison_when_recursive
klass1 = Struct.new(:a, :b, :c)