From 4a57c5e7d961e457826ea5dabb758b249d8faeb0 Mon Sep 17 00:00:00 2001 From: kosaki Date: Mon, 28 Feb 2011 13:52:58 +0000 Subject: * win32/win32.c (rb_w32_spawn): use shell if a commandline contain double-quote character. * win32/win32.c (is_internal_cmd): similar, use shell if a commandline contain caret character. * test/ruby/test_system.rb (TestSystem#test_system_at): fix wrong test case. if system() invoke a command by using shell, system() never return nil. Also, "" quotation must not appear twice in a command line. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30987 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_system.rb | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'test') diff --git a/test/ruby/test_system.rb b/test/ruby/test_system.rb index e54b0f4b43..34eb45f4c1 100644 --- a/test/ruby/test_system.rb +++ b/test/ruby/test_system.rb @@ -102,11 +102,10 @@ class TestSystem < Test::Unit::TestCase assert_equal("@@foo\n", `"echo" @@foo`, bug4396); assert_equal("@@foo\n", `"@@echo" @@foo`, bug4396); assert_equal("@@foo\n", `"@@echo @@foo"`, bug4396); - assert_equal('"@foo"\n', `"echo" "@foo"`, bug4396); # ^ + @ + built-in - assert_equal(nil, system('^@echo foo'), bug4396); - assert_equal(nil, system('"^@echo foo"'), bug4396); + assert_equal(false, system('^@echo foo'), bug4396); + assert_equal(false, system('"^@echo foo"'), bug4396); assert_equal("@foo\n", `echo ^@foo`); Dir.mktmpdir("ruby_script_tmp") {|tmpdir| @@ -120,8 +119,8 @@ class TestSystem < Test::Unit::TestCase assert_match(/\Abar\nbaz\n?\z/, `@@findstr "ba" #{tmpfilename.gsub("/", "\\")}`, bug4393); # "" + @ + non built-in - assert_match(/\Abar\nbaz\n?\z/, `"@@findstr" "ba" #{tmpfilename.gsub("/", "\\")}`, bug4396); - assert_match(/\A@foo\n?\z/, `"@@findstr" "@foo" #{tmpfilename.gsub("/", "\\")}`, bug4396); + assert_match(/\Abar\nbaz\n?\z/, `"@@findstr ba" #{tmpfilename.gsub("/", "\\")}`, bug4396); + assert_match(/\A@foo\n?\z/, `"@@findstr @foo" #{tmpfilename.gsub("/", "\\")}`, bug4396); } end end -- cgit v1.2.3