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

UnqualifiedConstants2() public method

If a constant is not found in the current scope chain, the inner-most module scope's module/class and its ancestors are checked.
public UnqualifiedConstants2 ( ) : void
return void
        public void UnqualifiedConstants2() {
            AssertOutput(delegate() {
                CompilerTest(@"
class D
  D = 'U in D'
end

class B
  W = 'W in B'
end

module M
  V = 'V in M'

  def puts_U
    puts U rescue puts $!
    puts W rescue puts $!
  end
end

class C < D
  class C < B
    include M    

    def puts_consts
      puts U rescue puts $!
      puts V, W
      puts_U
    end
  end 
end

C::C.new.puts_consts
");
            }, @"
uninitialized constant C::C::U
V in M
W in B
uninitialized constant M::U
uninitialized constant M::W
");
        }
Tests