aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby
diff options
context:
space:
mode:
authorJeremy Evans <code@jeremyevans.net>2019-11-28 17:28:13 -0800
committerJeremy Evans <code@jeremyevans.net>2019-11-29 20:32:03 +0200
commit0c273b2279e65c57161e0859f2d4e9f6e649b751 (patch)
treed7e85eace218625a43a85eb1c7c1d30c6e117d88 /test/ruby
parent8a1f313e2e6ecf43a1ccad6cca35f738c6052b3c (diff)
downloadruby-0c273b2279e65c57161e0859f2d4e9f6e649b751.tar.gz
Supress class variable overtaken warning when original modules are the same
This issue was exposed by recent commits to better support including refined modules.
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_variable.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/ruby/test_variable.rb b/test/ruby/test_variable.rb
index 6ed956c468..b053e11607 100644
--- a/test/ruby/test_variable.rb
+++ b/test/ruby/test_variable.rb
@@ -63,6 +63,29 @@ class TestVariable < Test::Unit::TestCase
assert_equal(1, o.singleton_class.class_variable_get(:@@foo))
end
+ class IncludeRefinedModuleClassVariableNoWarning
+ module Mod
+ @@_test_include_refined_module_class_variable = true
+ end
+
+ module Mod2
+ refine Mod do
+ end
+ end
+
+ include Mod
+
+ def t
+ @@_test_include_refined_module_class_variable
+ end
+ end
+
+ def test_include_refined_module_class_variable
+ assert_warning('') do
+ IncludeRefinedModuleClassVariableNoWarning.new.t
+ end
+ end
+
def test_variable
assert_instance_of(Integer, $$)