* test/lib/test/unit/assertions.rb (assert_in_out_err): add
  success option to check the exit status.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56267 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2016-09-27 08:35:30 +00:00
Родитель b15f76556f
Коммит 2ca58e4290
1 изменённых файлов: 11 добавлений и 1 удалений

Просмотреть файл

@ -548,7 +548,8 @@ EOT
faildesc faildesc
end end
def assert_in_out_err(args, test_stdin = "", test_stdout = [], test_stderr = [], message = nil, **opt) def assert_in_out_err(args, test_stdin = "", test_stdout = [], test_stderr = [], message = nil,
success: nil, **opt)
stdout, stderr, status = EnvUtil.invoke_ruby(args, test_stdin, true, true, **opt) stdout, stderr, status = EnvUtil.invoke_ruby(args, test_stdin, true, true, **opt)
if signo = status.termsig if signo = status.termsig
EnvUtil.diagnostic_reports(Signal.signame(signo), EnvUtil.rubybin, status.pid, Time.now) EnvUtil.diagnostic_reports(Signal.signame(signo), EnvUtil.rubybin, status.pid, Time.now)
@ -570,6 +571,15 @@ EOT
end end
end end
end end
unless success.nil?
a.for("success?") do
if success
assert_predicate(status, :success?)
else
assert_not_predicate(status, :success?)
end
end
end
end end
status status
end end