summaryrefslogtreecommitdiff
path: root/test/ruby/test_system.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-01-27 04:04:23 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-01-27 04:04:23 +0000
commitad1715f0b9802ddf23e83232661c7b67d2a0a7d6 (patch)
tree6c533bc5277e2b74c236f4de56f08c09fe0e0218 /test/ruby/test_system.rb
parentdbf8e164cea4dd8e8c99c223620f75af2ac627ce (diff)
test_system.rb: fix test
* test/ruby/test_system.rb (TestSystem#test_system_redirect_win): fix meaningless test. [Bug #7482] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38956 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_system.rb')
-rw-r--r--test/ruby/test_system.rb30
1 files changed, 25 insertions, 5 deletions
diff --git a/test/ruby/test_system.rb b/test/ruby/test_system.rb
index 13266d9d37..d66f9018c1 100644
--- a/test/ruby/test_system.rb
+++ b/test/ruby/test_system.rb
@@ -119,11 +119,31 @@ class TestSystem < Test::Unit::TestCase
return
end
- cmd = "%WINDIR%/system32/ping.exe \"BFI3CHL671\" > out.txt 2>NUL"
- assert_equal(false, system(cmd), '[ruby-talk:258939]');
-
- cmd = "\"%WINDIR%/system32/ping.exe BFI3CHL671\" > out.txt 2>NUL"
- assert_equal(false, system(cmd), '[ruby-talk:258939]');
+ Dir.mktmpdir("ruby_script_tmp") do |tmpdir|
+ cmd = nil
+ message = proc do
+ [
+ '[ruby-talk:258939]',
+ "out.txt:",
+ *File.readlines("out.txt").map{|s|" "+s.inspect},
+ "err.txt:",
+ *File.readlines("err.txt").map{|s|" "+s.inspect},
+ "system(#{cmd.inspect})"
+ ].join("\n")
+ end
+ class << message
+ alias to_s call
+ end
+ Dir.chdir(tmpdir) do
+ open("input.txt", "w") {|f| f.puts "BFI3CHL671"}
+ cmd = "%WINDIR%/system32/find.exe \"BFI3CHL671\" input.txt > out.txt 2>err.txt"
+ assert_equal(true, system(cmd), message)
+ cmd = "\"%WINDIR%/system32/find.exe\" \"BFI3CHL671\" input.txt > out.txt 2>err.txt"
+ assert_equal(true, system(cmd), message)
+ cmd = "\"%WINDIR%/system32/find.exe BFI3CHL671\" input.txt > out.txt 2>err.txt"
+ assert_equal(true, system(cmd), message)
+ end
+ end
end
def test_empty_evstr