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
This commit is contained in:
parent
dbf8e164ce
commit
ad1715f0b9
@ -119,11 +119,31 @@ class TestSystem < Test::Unit::TestCase
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
cmd = "%WINDIR%/system32/ping.exe \"BFI3CHL671\" > out.txt 2>NUL"
|
Dir.mktmpdir("ruby_script_tmp") do |tmpdir|
|
||||||
assert_equal(false, system(cmd), '[ruby-talk:258939]');
|
cmd = nil
|
||||||
|
message = proc do
|
||||||
cmd = "\"%WINDIR%/system32/ping.exe BFI3CHL671\" > out.txt 2>NUL"
|
[
|
||||||
assert_equal(false, system(cmd), '[ruby-talk:258939]');
|
'[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
|
end
|
||||||
|
|
||||||
def test_empty_evstr
|
def test_empty_evstr
|
||||||
|
Loading…
x
Reference in New Issue
Block a user