mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* test/ruby/envutil.rb (EnvUtil::Unit::Assertionsassert_separately):
added to execute given test source on separate process, catch its resulted exception and raise it on main process. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38369 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
2f0095e1ab
commit
bc2195e4fb
2 changed files with 23 additions and 0 deletions
|
@ -1,3 +1,9 @@
|
|||
Fri Dec 14 04:08:05 2012 NARUSE, Yui <naruse@ruby-lang.org>
|
||||
|
||||
* test/ruby/envutil.rb (EnvUtil::Unit::Assertionsassert_separately):
|
||||
added to execute given test source on separate process,
|
||||
catch its resulted exception and raise it on main process.
|
||||
|
||||
Fri Dec 14 07:43:44 2012 Aaron Patterson <aaron@tenderlovemaking.com>
|
||||
|
||||
* ext/psych/lib/psych/visitors/yaml_tree.rb: quote strings that begin
|
||||
|
|
|
@ -193,6 +193,23 @@ module Test
|
|||
assert(status.success?, m)
|
||||
end
|
||||
|
||||
def assert_separately(args, file, line, src)
|
||||
opt = {}
|
||||
src = <<eom
|
||||
require 'test/unit';include Test::Unit::Assertions;begin;#{src}
|
||||
ensure
|
||||
print [Marshal.dump($!)].pack('m')
|
||||
end
|
||||
eom
|
||||
stdout, _stderr, _status = EnvUtil.invoke_ruby(args, src, true, true, opt)
|
||||
res = Marshal.load(stdout.unpack("m")[0])
|
||||
return unless res
|
||||
res.backtrace.each do |l|
|
||||
l.sub!(/\A-:(\d+)/){"#{file}:#{line + $1.to_i}"}
|
||||
end
|
||||
raise res
|
||||
end
|
||||
|
||||
def assert_warning(pat, message = nil)
|
||||
stderr = EnvUtil.verbose_warning { yield }
|
||||
message = ' "' + message + '"' if message
|
||||
|
|
Loading…
Reference in a new issue