1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49822 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2015-03-03 08:17:51 +00:00
parent 41eb94d4b4
commit e9ff9e79e4

View file

@ -1248,26 +1248,12 @@ class TestProcess < Test::Unit::TestCase
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