diff options
Diffstat (limited to 'test/ruby/test_require.rb')
-rw-r--r-- | test/ruby/test_require.rb | 27 |
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 |