From 7d805e67f3275aef066d77aa9c32bef715c362ed Mon Sep 17 00:00:00 2001 From: Jean Boussier Date: Tue, 7 May 2019 12:00:57 +0200 Subject: Avoid triggering autoload in Module#const_defined?(String) [Bug #15780] --- test/ruby/test_autoload.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'test/ruby/test_autoload.rb') diff --git a/test/ruby/test_autoload.rb b/test/ruby/test_autoload.rb index 34e0178d0e..d4e8f20899 100644 --- a/test/ruby/test_autoload.rb +++ b/test/ruby/test_autoload.rb @@ -42,8 +42,10 @@ p Foo::Bar require 'tmpdir' Dir.mktmpdir('autoload') {|tmpdir| tmpfile = tmpdir + '/foo.rb' + tmpfile2 = tmpdir + '/bar.rb' a = Module.new do autoload :X, tmpfile + autoload :Y, tmpfile2 end b = Module.new do include a @@ -52,6 +54,10 @@ p Foo::Bar assert_equal(true, b.const_defined?(:X)) assert_equal(tmpfile, a.autoload?(:X), bug4565) assert_equal(tmpfile, b.autoload?(:X), bug4565) + assert_equal(true, a.const_defined?("Y")) + assert_equal(true, b.const_defined?("Y")) + assert_equal(tmpfile2, a.autoload?("Y")) + assert_equal(tmpfile2, b.autoload?("Y")) } end -- cgit v1.2.3