diff options
author | NARUSE, Yui <naruse@airemix.jp> | 2020-02-04 19:29:27 +0900 |
---|---|---|
committer | NARUSE, Yui <naruse@airemix.jp> | 2020-02-04 19:30:11 +0900 |
commit | 0529fead361c05754550e39daaa54076a04df6a3 (patch) | |
tree | 4c3ce592d80b78f6823746b85ad57ebb55d54681 /tool | |
parent | 7d6903dc476f982e7b432adbeef3a3d9372a309f (diff) | |
download | ruby-0529fead361c05754550e39daaa54076a04df6a3.tar.gz |
assert_separately uses their own pipe instead of stdout
Diffstat (limited to 'tool')
-rw-r--r-- | tool/lib/test/unit/core_assertions.rb | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/tool/lib/test/unit/core_assertions.rb b/tool/lib/test/unit/core_assertions.rb index 00555d6e32..6742e5043b 100644 --- a/tool/lib/test/unit/core_assertions.rb +++ b/tool/lib/test/unit/core_assertions.rb @@ -110,11 +110,13 @@ module Test file ||= loc.path line ||= loc.lineno end + res_p, res_c = IO.pipe + opt[res_c.fileno] = res_c.fileno src = <<eom # -*- coding: #{line += __LINE__; src.encoding}; -*- - require "test/unit";include Test::Unit::Assertions;require #{(__dir__ + "/core_assertions").dump};include Test::Unit::CoreAssertions + require "test/unit";out=IO.new(#{res_c.fileno});include Test::Unit::Assertions;require #{(__dir__ + "/core_assertions").dump};include Test::Unit::CoreAssertions END { - puts [Marshal.dump($!)].pack('m'), "assertions=\#{self._assertions}" + out.puts [Marshal.dump($!)].pack('m'), "assertions=\#{self._assertions}" } #{line -= __LINE__; src} class Test::Unit::Runner @@ -128,7 +130,10 @@ eom assert(!abort, FailDesc[status, nil, stderr]) self._assertions += stdout[/^assertions=(\d+)/, 1].to_i begin - res = Marshal.load(stdout.unpack("m")[0]) + res_c.close + puts stdout + STDERR.puts stderr + res = Marshal.load(res_p.read.unpack("m")[0]) rescue => marshal_error ignore_stderr = nil end |