ruby-changes:18901
From: kosaki <ko1@a...>
Date: Mon, 21 Feb 2011 00:40:00 +0900 (JST)
Subject: [ruby-changes:18901] Ruby:r30926 (trunk): * test/ruby/test_system.rb (TestSystem#test_system_at):
kosaki 2011-02-21 00:39:53 +0900 (Mon, 21 Feb 2011) New Revision: 30926 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=30926 Log: * test/ruby/test_system.rb (TestSystem#test_system_at): add testcase for bug4396. Modified files: trunk/ChangeLog trunk/test/ruby/test_system.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 30925) +++ ChangeLog (revision 30926) @@ -1,3 +1,8 @@ +Mon Feb 21 00:38:56 2011 KOSAKI Motohiro <kosaki.motohiro@g...> + + * test/ruby/test_system.rb (TestSystem#test_system_at): + add testcase for bug4396. + Sun Feb 20 19:59:32 2011 Tanaka Akira <akr@f...> * ext/openssl/ossl_cipher.c: parenthesize macro arguments. Index: test/ruby/test_system.rb =================================================================== --- test/ruby/test_system.rb (revision 30925) +++ test/ruby/test_system.rb (revision 30926) @@ -90,20 +90,38 @@ 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); - # @ + non builtin command + # "" + @ + 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`); + 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/