[前][次][番号順一覧][スレッド一覧]

ruby-changes:28007

From: naruse <ko1@a...>
Date: Tue, 2 Apr 2013 15:28:30 +0900 (JST)
Subject: [ruby-changes:28007] naruse:r40059 (trunk): * test/ruby/envutil.rb (assert_separately): stop_auto_run of

naruse	2013-04-02 15:28:15 +0900 (Tue, 02 Apr 2013)

  New Revision: 40059

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=40059

  Log:
    * test/ruby/envutil.rb (assert_separately): stop_auto_run of
      Test::Unit::Runner to prevent auto runner use ARGV.
    
    * test/ruby/envutil.rb (assert_separately): add $: to separate process.
    
    * test/ruby/envutil.rb (assert_separately): fail if stderr is not
      empty and ignore_stderr is false.

  Modified files:
    trunk/ChangeLog
    trunk/test/ruby/envutil.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 40058)
+++ ChangeLog	(revision 40059)
@@ -1,3 +1,13 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Apr  2 15:22:09 2013  NARUSE, Yui  <naruse@r...>
+
+	* test/ruby/envutil.rb (assert_separately): stop_auto_run of
+	  Test::Unit::Runner to prevent auto runner use ARGV.
+
+	* test/ruby/envutil.rb (assert_separately): add $: to separate process.
+
+	* test/ruby/envutil.rb (assert_separately): fail if stderr is not
+	  empty and ignore_stderr is false.
+
 Tue Apr  2 06:46:59 2013  Tanaka Akira  <akr@f...>
 
 	* ext/-test-/num2int/num2int.c: Rename utility methods
Index: test/ruby/envutil.rb
===================================================================
--- test/ruby/envutil.rb	(revision 40058)
+++ test/ruby/envutil.rb	(revision 40059)
@@ -287,17 +287,31 @@ module Test https://github.com/ruby/ruby/blob/trunk/test/ruby/envutil.rb#L287
   ensure
     puts [Marshal.dump($!)].pack('m'), "assertions=\#{self._assertions}"
   end
+  class Test::Unit::Runner
+    @@stop_auto_run = true
+  end
 eom
+        args = args.dup
+        $:.each{|l| args.unshift "-I#{l}" }
+        ignore_stderr = opt.delete(:ignore_stderr)
         stdout, stderr, status = EnvUtil.invoke_ruby(args, src, true, true, opt)
         abort = status.coredump? || (status.signaled? && ABORT_SIGNALS.include?(status.termsig))
         assert(!abort, FailDesc[status, stderr])
         self._assertions += stdout[/^assertions=(\d+)/, 1].to_i
         res = Marshal.load(stdout.unpack("m")[0])
-        return unless res
-        res.backtrace.each do |l|
-          l.sub!(/\A-:(\d+)/){"#{file}:#{line + $1.to_i}"}
+        if res
+          res.backtrace.each do |l|
+            l.sub!(/\A-:(\d+)/){"#{file}:#{line + $1.to_i}"}
+          end
+          raise res
+        end
+
+        # really is it succeed?
+        unless ignore_stderr
+          # the body of assert_separately must not output anything to detect errror
+          assert_equal("", stderr, "assert_separately failed with error message")
         end
-        raise res
+        assert_equal(0, status, "assert_separately failed: '#{stderr}'")
       end
 
       def assert_warning(pat, msg = nil)

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]