ruby-changes:26904
From: nobu <ko1@a...>
Date: Sun, 27 Jan 2013 13:04:35 +0900 (JST)
Subject: [ruby-changes:26904] nobu:r38956 (trunk): test_system.rb: fix test
nobu 2013-01-27 13:04:23 +0900 (Sun, 27 Jan 2013) New Revision: 38956 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=38956 Log: test_system.rb: fix test * test/ruby/test_system.rb (TestSystem#test_system_redirect_win): fix meaningless test. [Bug #7482] Modified files: trunk/test/ruby/test_system.rb Index: test/ruby/test_system.rb =================================================================== --- test/ruby/test_system.rb (revision 38955) +++ test/ruby/test_system.rb (revision 38956) @@ -119,11 +119,31 @@ class TestSystem < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_system.rb#L119 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/