1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/test/ruby/test_require.rb
nobu 3dea38333c * eval.c (search_required): expand home relative path first.
[ruby-core:29610]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@27398 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-19 10:13:14 +00:00

27 lines
646 B
Ruby

require 'test/unit'
require 'tempfile'
require File.expand_path('../envutil', __FILE__)
require 'tmpdir'
class TestRequire < Test::Unit::TestCase
def test_home_path
home = ENV["HOME"]
bug3171 = '[ruby-core:29610]'
Dir.mktmpdir do |tmp|
ENV["HOME"] = tmp
name = "loadtest#{$$}-1"
path = File.join(tmp, name) << ".rb"
open(path, "w") {}
require "~/#{name}"
assert_equal(path, $"[-1], bug3171)
name.succ!
path = File.join(tmp, name << ".rb")
open(path, "w") {}
require "~/#{name}"
assert_equal(path, $"[-1], bug3171)
end
ensure
ENV["HOME"] = home
end
end