summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_variable.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/ruby/test_variable.rb b/test/ruby/test_variable.rb
index b053e11607..685a06226f 100644
--- a/test/ruby/test_variable.rb
+++ b/test/ruby/test_variable.rb
@@ -35,6 +35,16 @@ class TestVariable < Test::Unit::TestCase
end
end
+ def test_setting_class_variable_on_module_through_inheritance
+ mod = Module.new
+ mod.class_variable_set(:@@foo, 1)
+ mod.freeze
+ c = Class.new { include(mod) }
+ assert_raise(FrozenError) { c.class_variable_set(:@@foo, 2) }
+ assert_raise(FrozenError) { c.class_eval("@@foo = 2") }
+ assert_equal(1, c.class_variable_get(:@@foo))
+ end
+
def test_singleton_class_included_class_variable
c = Class.new
c.extend(Olympians)