public void SingletonCaching2C() {
TestOutput(@"
A = System::Collections::ArrayList
class A
def to_s
'base'
end
end
foo, bar = A.new, A.new
puts bar.to_s
puts foo.to_s
def foo.to_s; 'singleton 1'; end
puts bar.to_s
puts foo.to_s
def foo.to_s; 'singleton 2'; end
[bar, foo, nil, 1].each { |x| puts x.to_s }
", @"
base
base
base
singleton 1
base
singleton 2
1
");
}