mirror of
https://github.com/ruby/ruby.git
synced 2025-09-23 20:44:00 +02:00
* object.c (rb_mod_cvar_set): call to_str for string only once.
to_str was called from rb_is_class_name and rb_to_id before. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40174 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
875bba3fc5
commit
d9ff5c2230
3 changed files with 17 additions and 5 deletions
|
@ -665,6 +665,7 @@ class TestModule < Test::Unit::TestCase
|
|||
c.class_eval('@@foo = :foo')
|
||||
assert_equal(:foo, c.class_variable_get(:@@foo))
|
||||
assert_raise(NameError) { c.class_variable_get(:@@bar) } # c.f. instance_variable_get
|
||||
assert_raise(NameError) { c.class_variable_get('@@') }
|
||||
assert_raise(NameError) { c.class_variable_get(:foo) }
|
||||
assert_raise(NameError) { c.class_variable_get("bar") }
|
||||
assert_raise(TypeError) { c.class_variable_get(1) }
|
||||
|
@ -674,6 +675,7 @@ class TestModule < Test::Unit::TestCase
|
|||
c = Class.new
|
||||
c.class_variable_set(:@@foo, :foo)
|
||||
assert_equal(:foo, c.class_eval('@@foo'))
|
||||
assert_raise(NameError) { c.class_variable_set('@@', 1) }
|
||||
assert_raise(NameError) { c.class_variable_set(:foo, 1) }
|
||||
assert_raise(NameError) { c.class_variable_set("bar", 1) }
|
||||
assert_raise(TypeError) { c.class_variable_set(1, 1) }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue