summaryrefslogtreecommitdiff
path: root/test/ruby/test_file_exhaustive.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-03-11 00:50:31 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-03-11 00:50:31 +0000
commitc0035ed35141b2675ec0f395b3a214f967ad7190 (patch)
treefb579e8d98d9d222af250e18d9a1f105db2c5c4c /test/ruby/test_file_exhaustive.rb
parent3176b04d22aaf046bdcc05161a11a1f653dd80e4 (diff)
test_file_exhaustive.rb: others home
* test/ruby/test_file_exhaustive.rb (test_expand_path_home_dir_string): add assertions for other user's home directory path. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39716 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_file_exhaustive.rb')
-rw-r--r--test/ruby/test_file_exhaustive.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/test/ruby/test_file_exhaustive.rb b/test/ruby/test_file_exhaustive.rb
index 20097c58f9..d3a44d1234 100644
--- a/test/ruby/test_file_exhaustive.rb
+++ b/test/ruby/test_file_exhaustive.rb
@@ -475,10 +475,12 @@ class TestFileExhaustive < Test::Unit::TestCase
ENV["HOME"] = home
end
+ UnknownUserHome = "~foo_bar_baz_unknown_user_wahaha".freeze
+
def test_expand_path_home
assert_kind_of(String, File.expand_path("~")) if ENV["HOME"]
- assert_raise(ArgumentError) { File.expand_path("~foo_bar_baz_unknown_user_wahaha") }
- assert_raise(ArgumentError) { File.expand_path("~foo_bar_baz_unknown_user_wahaha", "/") }
+ assert_raise(ArgumentError) { File.expand_path(UnknownUserHome) }
+ assert_raise(ArgumentError) { File.expand_path(UnknownUserHome, "/") }
begin
bug3630 = '[ruby-core:31537]'
home = ENV["HOME"]
@@ -510,6 +512,9 @@ class TestFileExhaustive < Test::Unit::TestCase
assert_equal File.join(new_home, "foo"), File.expand_path("foo", "~"), bug8034
assert_equal File.join(new_home, "bar", "foo"), File.expand_path("foo", "~/bar"), bug8034
+
+ assert_raise(ArgumentError) { File.expand_path(".", UnknownUserHome) }
+ assert_nothing_raised(ArgumentError) { File.expand_path("/", UnknownUserHome) }
ensure
ENV["HOME"] = home
end