summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-12-09 12:25:34 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-12-09 12:25:34 +0000
commit00f4c13e22967de1d7e42085b2fc32bf6718f580 (patch)
treea35a45552ac3ea44b05036cca669ca18ed31e281 /test
parent15eba4ed0ebb4e019a037b0af10b34fdbc85e03a (diff)
merge revision(s) 7d805e67f3275aef066d77aa9c32bef715c362ed: [Backport #15780]
Avoid triggering autoload in Module#const_defined?(String) [Bug #15780] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_6@67831 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-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 8311c40c35..1d2d1af00c 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