mirror of
https://github.com/ruby/ruby.git
synced 2025-09-16 17:14:01 +02:00
struct.c: avoid pinning down
* struct.c (rb_struct_set, rb_struct_aref, rb_struct_aset): get rid of pinning down dynamic symbols by SYM2ID. * struct.c (rb_struct_aref_sym, rb_struct_aset_sym): use Symbol instead of ID. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45465 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
fd8f3cb987
commit
1d223a3bdf
2 changed files with 19 additions and 12 deletions
|
@ -158,6 +158,8 @@ module TestStruct
|
|||
assert_equal(1, o[0])
|
||||
assert_raise(IndexError) { o[-2] }
|
||||
assert_raise(IndexError) { o[1] }
|
||||
assert_raise_with_message(NameError, /foo/) {o["foo"]}
|
||||
assert_raise_with_message(NameError, /foo/) {o[:foo]}
|
||||
end
|
||||
|
||||
def test_aset
|
||||
|
@ -167,6 +169,8 @@ module TestStruct
|
|||
assert_equal(2, o[:a])
|
||||
assert_raise(IndexError) { o[-2] = 3 }
|
||||
assert_raise(IndexError) { o[1] = 3 }
|
||||
assert_raise_with_message(NameError, /foo/) {o["foo"] = 3}
|
||||
assert_raise_with_message(NameError, /foo/) {o[:foo] = 3}
|
||||
end
|
||||
|
||||
def test_values_at
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue