public void ConstantCaching_Qualified2() {
TestOutput(@"
module A
module B
$B = self
module C
D = 1
end
def self.const_missing(name)
puts 'missing: ' + name.to_s
$C
end
end
end
module C
$C = self
module D
end
end
module E
$E = self
D = 2
end
i = 0
while i < 6
p A::B::C::D # tested cache
$B.send(:remove_const, :C) if i == 1
$B.send(:const_set, :C, $E) if i == 3
i += 1
end
", @"
1
1
missing: C
C::D
missing: C
C::D
2
2
");
}