From bf794afbf90ca3041f1046fdb10863dc049c9786 Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 5 Feb 2011 01:09:39 +0000 Subject: * load.c (rb_get_expanded_load_path): always expand load paths. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30789 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_autoload.rb | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'test') diff --git a/test/ruby/test_autoload.rb b/test/ruby/test_autoload.rb index c2039086cf..eeedc7d988 100644 --- a/test/ruby/test_autoload.rb +++ b/test/ruby/test_autoload.rb @@ -9,4 +9,29 @@ class TestAutoload < Test::Unit::TestCase begin Continuation; rescue LoadError; end INPUT end + + def test_non_realpath_in_loadpath + require 'tmpdir' + tmpdir = Dir.mktmpdir('autoload') + tmpdirs = [tmpdir] + tmpdirs.unshift(tmpdir + '/foo') + Dir.mkdir(tmpdirs[0]) + tmpfiles = [tmpdir + '/foo.rb', tmpdir + '/foo/bar.rb'] + open(tmpfiles[0] , 'w') do |f| + f.puts <<-INPUT +$:.unshift(File.expand_path('..', __FILE__)+'/./foo') +module Foo + autoload :Bar, 'bar' +end +Foo::Bar + INPUT + end + open(tmpfiles[1], 'w') do |f| + f.puts 'class Foo::Bar; end' + end + assert_in_out_err([tmpfiles[0]], "", [], []) + ensure + File.unlink(*tmpfiles) rescue nil if tmpfiles + tmpdirs.each {|dir| Dir.rmdir(dir)} + end end -- cgit v1.2.3