summaryrefslogtreecommitdiff
path: root/test/ruby/test_autoload.rb
diff options
context:
space:
mode:
authorJean Boussier <jean.boussier@gmail.com>2019-05-07 12:00:57 +0200
committerNobuyoshi Nakada <nobu@ruby-lang.org>2019-05-07 21:20:01 +0900
commit7d805e67f3275aef066d77aa9c32bef715c362ed (patch)
treea380ab7eb259a345eaa9485d28a4c71969647d3a /test/ruby/test_autoload.rb
parent6786fe44dcbb560d896bb9bb5baa9dc74677ce17 (diff)
Avoid triggering autoload in Module#const_defined?(String)
[Bug #15780]
Diffstat (limited to 'test/ruby/test_autoload.rb')
-rw-r--r--test/ruby/test_autoload.rb6
1 files changed, 6 insertions, 0 deletions
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