IronRuby.Tests.Tests.ConstantCaching_Qualified_IsDefined1 C# (CSharp) Method

ConstantCaching_Qualified_IsDefined1() public method

public ConstantCaching_Qualified_IsDefined1 ( ) : void
return void
        public void ConstantCaching_Qualified_IsDefined1() {
            TestOutput(@"
module A
  module B
    $B = self

    module C
      D = 1                              # D is not module here
    end

    def self.const_missing(name)
      puts 'missing: ' + name.to_s
      $C
    end
  end
end

module C
  $C = self
  module D    
    F = 1
  end
end

module E
  $E = self
  module D  
    F = 2
  end
end

i = 0
while i < 6
  puts defined?(A::B::C::D::F)              # tested cache
  $B.send(:remove_const, :C) if i == 1
  $B.send(:const_set, :C, $E) if i == 3
  i += 1
end
", @"
nil
nil
missing: C
constant
missing: C
constant
constant
constant
");
        }
Tests