ruby-changes:27664
From: nobu <ko1@a...>
Date: Mon, 11 Mar 2013 09:50:40 +0900 (JST)
Subject: [ruby-changes:27664] nobu:r39716 (trunk): test_file_exhaustive.rb: others home
nobu 2013-03-11 09:50:31 +0900 (Mon, 11 Mar 2013) New Revision: 39716 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=39716 Log: 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. Modified files: trunk/test/ruby/test_file_exhaustive.rb Index: test/ruby/test_file_exhaustive.rb =================================================================== --- test/ruby/test_file_exhaustive.rb (revision 39715) +++ test/ruby/test_file_exhaustive.rb (revision 39716) @@ -475,10 +475,12 @@ class TestFileExhaustive < Test::Unit::T https://github.com/ruby/ruby/blob/trunk/test/ruby/test_file_exhaustive.rb#L475 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::T https://github.com/ruby/ruby/blob/trunk/test/ruby/test_file_exhaustive.rb#L512 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/