diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-12-14 01:38:07 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-12-14 01:38:07 +0000 |
commit | bc2195e4fbf7281af3a0bd055d4263690d7aad9f (patch) | |
tree | 99ecf2313703bb9c86383aaaae434212495563c3 /test/ruby/envutil.rb | |
parent | 2f0095e1abf1cdfe1d0cdabc0d24260f602810b2 (diff) | |
download | ruby-bc2195e4fbf7281af3a0bd055d4263690d7aad9f.tar.gz |
* 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
Diffstat (limited to 'test/ruby/envutil.rb')
-rw-r--r-- | test/ruby/envutil.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/ruby/envutil.rb b/test/ruby/envutil.rb index 657e991e3f..edcda0ceba 100644 --- a/test/ruby/envutil.rb +++ b/test/ruby/envutil.rb @@ -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 |