ruby-changes:16547
From: akr <ko1@a...>
Date: Sun, 4 Jul 2010 22:04:11 +0900 (JST)
Subject: [ruby-changes:16547] Ruby:r28539 (trunk): * test/ruby/test_system.rb (test_syntax): unified with test_syntax2.
akr 2010-07-04 22:03:04 +0900 (Sun, 04 Jul 2010) New Revision: 28539 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=28539 Log: * test/ruby/test_system.rb (test_syntax): unified with test_syntax2. Modified files: trunk/ChangeLog trunk/test/ruby/test_system.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 28538) +++ ChangeLog (revision 28539) @@ -1,3 +1,7 @@ +Sun Jul 4 22:02:02 2010 Tanaka Akira <akr@f...> + + * test/ruby/test_system.rb (test_syntax): unified with test_syntax2. + Sun Jul 4 21:00:39 2010 Tanaka Akira <akr@f...> * test/ruby/test_system.rb (test_syntax2): moved from sample/test.rb Index: test/ruby/test_system.rb =================================================================== --- test/ruby/test_system.rb (revision 28538) +++ test/ruby/test_system.rb (revision 28539) @@ -14,19 +14,6 @@ false end - def valid_syntax2?(code, fname) - p fname - code = code.dup.force_encoding("ascii-8bit") - code.sub!(/\A(?:\xef\xbb\xbf)?(\s*\#.*$)*(\n)?/n) { - "#$&#{"\n" if $1 && !$2}BEGIN{throw tag, :ok}\n" - } - code.force_encoding("us-ascii") - catch {|tag| eval(code, binding, fname, 0)} - rescue Exception - STDERR.puts $!.message - false - end - def test_system ruby = EnvUtil.rubybin assert_equal("foobar\n", `echo foobar`) @@ -114,26 +101,12 @@ def test_syntax assert_nothing_raised(Exception) do - for script in Dir[File.expand_path("../../../{lib,sample,ext}/**/*.rb", __FILE__)] - valid_syntax? IO::read(script), script + for script in Dir[File.expand_path("../../../{lib,sample,ext,test}/**/*.rb", __FILE__)].sort + assert(valid_syntax?(IO::read(script), script)) end end end - def test_syntax2 - if (dir = File.dirname(File.dirname(File.dirname(__FILE__)))) == '.' - dir = "" - else - dir << "/" - end - for script in Dir["#{dir}{lib,sample,ext,test}/**/*.rb"].sort - unless valid_syntax2? IO::read(script), script - STDERR.puts script - flunk("syntax error: #{script}") - end - end - end - def test_empty_evstr assert_equal("", eval('"#{}"', nil, __FILE__, __LINE__), "[ruby-dev:25113]") end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/