diff options
Diffstat (limited to 'test/ruby/test_autoload.rb')
-rw-r--r-- | test/ruby/test_autoload.rb | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/test/ruby/test_autoload.rb b/test/ruby/test_autoload.rb index dd049f047a..e175e57006 100644 --- a/test/ruby/test_autoload.rb +++ b/test/ruby/test_autoload.rb @@ -39,17 +39,18 @@ p Foo::Bar bug4565 = '[ruby-core:35679]' require 'tmpdir' - tmpdir = Dir.mktmpdir('autoload') - tmpfile = tmpdir + '/foo.rb' - a = Module.new do - autoload :X, tmpfile - end - b = Module.new do - include a - end - assert_equal(true, a.const_defined?(:X)) - assert_equal(true, b.const_defined?(:X)) - assert_equal(tmpfile, a.autoload?(:X), bug4565) - assert_equal(tmpfile, b.autoload?(:X), bug4565) + Dir.mktmpdir('autoload') {|tmpdir| + tmpfile = tmpdir + '/foo.rb' + a = Module.new do + autoload :X, tmpfile + end + b = Module.new do + include a + end + assert_equal(true, a.const_defined?(:X)) + assert_equal(true, b.const_defined?(:X)) + assert_equal(tmpfile, a.autoload?(:X), bug4565) + assert_equal(tmpfile, b.autoload?(:X), bug4565) + } end end |