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

ruby-changes:37741

From: nobu <ko1@a...>
Date: Tue, 3 Mar 2015 17:18:02 +0900 (JST)
Subject: [ruby-changes:37741] nobu:r49822 (trunk): test_process.rb: use assert_in_out_err

nobu	2015-03-03 17:17:51 +0900 (Tue, 03 Mar 2015)

  New Revision: 49822

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

  Log:
    test_process.rb: use assert_in_out_err
    
    * test/ruby/test_process.rb (test_status_quit): use
      assert_in_out_err to simplify and clean diagnostic reports.

  Modified files:
    trunk/test/ruby/test_process.rb
Index: test/ruby/test_process.rb
===================================================================
--- test/ruby/test_process.rb	(revision 49821)
+++ test/ruby/test_process.rb	(revision 49822)
@@ -1248,26 +1248,12 @@ class TestProcess < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_process.rb#L1248
     return unless Signal.list.include?("QUIT")
 
     with_tmpchdir do
-      write_file("foo", "puts;STDOUT.flush;sleep 30")
-      pid = nil
-      IO.pipe do |r, w|
-        pid = spawn(RUBY, "foo", out: w)
-        w.close
-        th = Thread.new { r.read(1); Process.kill(:SIGQUIT, pid) }
-        Process.wait(pid)
-        th.join
-      end
-      t = Time.now
-      s = $?
+      s = assert_in_out_err([], "Process.kill(:SIGQUIT, $$);sleep 30", //, //)
       assert_equal([false, true, false, nil],
                    [s.exited?, s.signaled?, s.stopped?, s.success?],
                    "[s.exited?, s.signaled?, s.stopped?, s.success?]")
-      assert_send(
-        [["#<Process::Status: pid #{ s.pid } SIGQUIT (signal #{ s.termsig })>",
-          "#<Process::Status: pid #{ s.pid } SIGQUIT (signal #{ s.termsig }) (core dumped)>"],
-         :include?,
-         s.inspect])
-      EnvUtil.diagnostic_reports("QUIT", RUBY, pid, t)
+      assert_equal("#<Process::Status: pid #{ s.pid } SIGQUIT (signal #{ s.termsig })>",
+                   s.inspect.sub(/ \(core dumped\)(?=>\z)/, ''))
     end
   end
 

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

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