diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_variable.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/ruby/test_variable.rb b/test/ruby/test_variable.rb index 1158313776..e50b681ce8 100644 --- a/test/ruby/test_variable.rb +++ b/test/ruby/test_variable.rb @@ -49,6 +49,19 @@ class TestVariable < Test::Unit::TestCase assert_equal(1, c.class_variable_get(:@@foo)) end + Zeus = Gods.clone + + def test_cloned_allows_setting_cvar + Zeus.class_variable_set(:@@rule, "Athena") + + god = Gods.new.ruler0 + zeus = Zeus.new.ruler0 + + assert_equal "Cronus", god + assert_equal "Athena", zeus + assert_not_equal god.object_id, zeus.object_id + end + def test_singleton_class_included_class_variable c = Class.new c.extend(Olympians) |