From deeda1ca87cfc80df8d7200f92b1e6287a39f80c Mon Sep 17 00:00:00 2001 From: kosaki Date: Sun, 20 Feb 2011 15:39:53 +0000 Subject: [PATCH] * test/ruby/test_system.rb (TestSystem#test_system_at): add testcase for bug4396. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30926 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ test/ruby/test_system.rb | 30 ++++++++++++++++++++++++------ 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index c2655d79f8..44c12001a6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Mon Feb 21 00:38:56 2011 KOSAKI Motohiro + + * test/ruby/test_system.rb (TestSystem#test_system_at): + add testcase for bug4396. + Sun Feb 20 19:59:32 2011 Tanaka Akira * ext/openssl/ossl_cipher.c: parenthesize macro arguments. diff --git a/test/ruby/test_system.rb b/test/ruby/test_system.rb index 3d55eee725..bb77ad445e 100644 --- a/test/ruby/test_system.rb +++ b/test/ruby/test_system.rb @@ -90,20 +90,38 @@ class TestSystem < Test::Unit::TestCase def test_system_at if /mswin|mingw/ =~ RUBY_PLATFORM - testname = '[ruby-core:35218]' + bug4393 = '[ruby-core:35218]' + bug4396 = '[ruby-core:35227]' # @ + builtin command - assert_equal("foo\n", `@echo foo`, testname); - assert_equal("foo\n", `@@echo foo`, testname); + assert_equal("foo\n", `@echo foo`, bug4393); + assert_equal("foo\n", `@@echo foo`, bug4393); + assert_equal("@@foo\n", `@@echo @@foo`, bug4393); + + # "" + @ + built-in + 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("@foo\n", `echo ^@foo`); - # @ + non builtin command Dir.mktmpdir("ruby_script_tmp") {|tmpdir| tmpfilename = "#{tmpdir}/ruby_script_tmp.#{$$}" tmp = open(tmpfilename, "w") - tmp.print "foo\nbar\nbaz"; + tmp.print "foo\nbar\nbaz\n@foo"; tmp.close - assert_match(/\Abar\nbaz\n?\z/, `@@findstr "ba" #{tmpfilename.gsub("/", "\\")}`, testname); + + # @ + non builtin command + 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); } end end