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

* test/rake/test_win32.rb (Rake::TestWin32): update tests.

[ruby-core:30309]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28145 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2010-06-03 09:17:49 +00:00
parent 188881b2a8
commit 55789617ae
2 changed files with 11 additions and 31 deletions

View file

@ -1,4 +1,7 @@
Thu Jun 3 13:05:15 2010 Nobuyoshi Nakada <nobu@ruby-lang.org> Thu Jun 3 18:17:45 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
* test/rake/test_win32.rb (Rake::TestWin32): update tests.
[ruby-core:30309]
* test/io/nonblock/test_flush.rb (test_flush): try pipe and * test/io/nonblock/test_flush.rb (test_flush): try pipe and
socketpair. [ruby-dev:41517] socketpair. [ruby-dev:41517]

View file

@ -9,47 +9,24 @@ class Rake::TestWin32 < Test::Unit::TestCase
Win32 = Rake::Win32 Win32 = Rake::Win32
def test_win32_system_dir_uses_home_if_defined def test_win32_system_dir_uses_home_if_defined
in_environment('RAKE_SYSTEM' => nil, 'HOME' => 'C:\\HP') do in_environment('RAKE_SYSTEM' => nil,
assert_equal "C:/HP/Rake", Win32.win32_system_dir 'HOME' => "C:\\HP",
end 'APPDATA' => nil
end
def test_win32_system_dir_uses_homedrive_homepath_when_no_home_defined
in_environment(
'RAKE_SYSTEM' => nil,
'HOME' => nil,
'HOMEDRIVE' => "C:",
'HOMEPATH' => "\\HP"
) do ) do
assert_equal "C:/HP/Rake", Win32.win32_system_dir assert_equal "C:/HP/Rake", Win32.win32_system_dir
end end
end end
def test_win32_system_dir_uses_appdata_when_no_home_or_home_combo def test_win32_system_dir_uses_appdata_if_defined
in_environment( in_environment(
'RAKE_SYSTEM' => nil, 'RAKE_SYSTEM' => nil,
'HOME' => nil, 'HOME' => "C:\\HP",
'HOMEDRIVE' => nil,
'HOMEPATH' => nil,
'APPDATA' => "C:\\Documents and Settings\\HP\\Application Data" 'APPDATA' => "C:\\Documents and Settings\\HP\\Application Data"
) do ) do
assert_equal "C:/Documents and Settings/HP/Application Data/Rake", Win32.win32_system_dir assert_equal "C:/Documents and Settings/HP/Application Data/Rake", Win32.win32_system_dir
end end
end end
def test_win32_system_dir_fallback_to_userprofile_otherwise
in_environment(
'RAKE_SYSTEM' => nil,
'HOME' => nil,
'HOMEDRIVE' => nil,
'HOMEPATH' => nil,
'APPDATA' => nil,
'USERPROFILE' => "C:\\Documents and Settings\\HP"
) do
assert_equal "C:/Documents and Settings/HP/Rake", Win32.win32_system_dir
end
end
def test_win32_system_dir_nil_of_no_env_vars def test_win32_system_dir_nil_of_no_env_vars
in_environment( in_environment(
'RAKE_SYSTEM' => nil, 'RAKE_SYSTEM' => nil,
@ -57,9 +34,9 @@ class Rake::TestWin32 < Test::Unit::TestCase
'HOMEDRIVE' => nil, 'HOMEDRIVE' => nil,
"HOMEPATH" => nil, "HOMEPATH" => nil,
'APPDATA' => nil, 'APPDATA' => nil,
"USERPROFILE" => nil 'USERPROFILE' => "C:\\Documents and Settings\\HP"
) do ) do
assert_raise(Rake::Win32::Win32HomeError) do assert_raise(ArgumentError) do
Win32.win32_system_dir Win32.win32_system_dir
end end
end end