1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* file.c (file_expand_path): home directory must be absolute.

[ruby-core:31537]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28796 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2010-07-29 23:51:53 +00:00
parent a99de84663
commit 6d56e80ad1
3 changed files with 31 additions and 4 deletions

View file

@ -397,6 +397,18 @@ class TestFileExhaustive < Test::Unit::TestCase
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
assert_incompatible_encoding {|d| File.expand_path(d)}
end