summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-11-22 07:21:56 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-11-22 07:21:56 +0000
commitfb5c60ddbe7693146ea893afa5b2b62de3aa02c3 (patch)
treef86ed77867313f768325f50633363b27add33426 /test
parent85697688b4ff8dc34b7fbc1616f04c5eb06563f7 (diff)
Thu, 29 Jul 2010 23:33:21 +0000 nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>
merge revision(s) 28794:28796: * file.c (file_expand_path): should check if could find user. [ruby-core:31538] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@28795 b2dd03c8-39d4-4d8f-98ff-823fe69b080e Signed-off-by: URABE, Shyouhei <shyouhei@ruby-lang.org> * file.c (file_expand_path): home directory must be absolute. [ruby-core:31537] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@28796 b2dd03c8-39d4-4d8f-98ff-823fe69b080e Signed-off-by: URABE, Shyouhei <shyouhei@ruby-lang.org> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@29859 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_file_exhaustive.rb15
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