summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-06-08 06:30:35 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-06-08 06:30:35 +0000
commit6e37bdc69f2d910432d20d5e29b8c8268aa06eb4 (patch)
tree7bd0c561a42b4e4d9c64fee779c9a9eacb3bfbe1 /test
parent1bb0917fa78b151729f8e40a98635ffd1ae72e09 (diff)
merge revision(s) 27398:
* 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_7@28210 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_require.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/ruby/test_require.rb b/test/ruby/test_require.rb
new file mode 100644
index 0000000000..aa96d4eabe
--- /dev/null
+++ b/test/ruby/test_require.rb
@@ -0,0 +1,27 @@
+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