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

assert_in_out_err should use FailDesc too

This commit is contained in:
Nobuyoshi Nakada 2019-09-27 21:07:53 +09:00
parent 8d0ff88727
commit 03284fb911
No known key found for this signature in database
GPG key ID: 4BC7D6DF58D8DF60

View file

@ -52,15 +52,13 @@ module Test
args = Array(args).dup
args.insert((Hash === args[0] ? 1 : 0), '--disable=gems')
stdout, stderr, status = EnvUtil.invoke_ruby(args, test_stdin, true, true, **opt)
if signo = status.termsig
EnvUtil.diagnostic_reports(Signal.signame(signo), status.pid, Time.now)
end
desc = FailDesc[status, message, stderr]
if block_given?
raise "test_stdout ignored, use block only or without block" if test_stdout != []
raise "test_stderr ignored, use block only or without block" if test_stderr != []
yield(stdout.lines.map {|l| l.chomp }, stderr.lines.map {|l| l.chomp }, status)
else
all_assertions(message) do |a|
all_assertions(desc) do |a|
[["stdout", test_stdout, stdout], ["stderr", test_stderr, stderr]].each do |key, exp, act|
a.for(key) do
if exp.is_a?(Regexp)