diff options
Diffstat (limited to 'test/ruby/test_file_exhaustive.rb')
-rw-r--r-- | test/ruby/test_file_exhaustive.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/ruby/test_file_exhaustive.rb b/test/ruby/test_file_exhaustive.rb index eb4c77fc54..f47258c7f2 100644 --- a/test/ruby/test_file_exhaustive.rb +++ b/test/ruby/test_file_exhaustive.rb @@ -353,6 +353,21 @@ class TestFileExhaustive < Test::Unit::TestCase assert_equal(@file, File.expand_path(@file + ".")) assert_equal(@file, File.expand_path(@file + "::$DATA")) end + assert_kind_of(String, File.expand_path("~")) + assert_raise(ArgumentError) { File.expand_path("~foo_bar_baz_unknown_user_wahaha") } + assert_raise(ArgumentError) { File.expand_path("~foo_bar_baz_unknown_user_wahaha", "/") } + begin + bug3630 = '[ruby-core:31537]' + home = ENV["HOME"] + ENV["HOME"] = nil + assert_raise(ArgumentError) { File.expand_path("~") } + ENV["HOME"] = "~" + assert_raise(ArgumentError, bug3630) { File.expand_path("~") } + ENV["HOME"] = "." + assert_raise(ArgumentError, bug3630) { File.expand_path("~") } + ensure + ENV["HOME"] = home + end end def test_basename |