mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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
1 changed files with 25 additions and 5 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue