From fd0f79ca677759251e011cbe3f7fbbe88db57b62 Mon Sep 17 00:00:00 2001 From: Kouichi Nakanishi Date: Thu, 6 Apr 2017 23:31:34 +0900 Subject: Get constant of parent class even if child class is defined in signleton class; fix #3575 --- test/t/class.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'test') diff --git a/test/t/class.rb b/test/t/class.rb index 54fadc0ca..eb077fce6 100644 --- a/test/t/class.rb +++ b/test/t/class.rb @@ -410,6 +410,20 @@ assert('class variable in module and class << self style class method') do assert_equal("value", ClassVariableInModuleTest.class_variable) end +assert('child class/module defined in singleton class get parent constant') do + actual = module GetParentConstantTest + EXPECT = "value" + class << self + class CHILD + class << self + EXPECT + end + end + end + end + assert_equal("value", actual) +end + assert('overriding class variable with a module (#3235)') do module ModuleWithCVar @@class_variable = 1 -- cgit v1.2.3