diff --git a/test/lib/test/unit/assertions.rb b/test/lib/test/unit/assertions.rb index c3a2a5b36e..da2fc59425 100644 --- a/test/lib/test/unit/assertions.rb +++ b/test/lib/test/unit/assertions.rb @@ -852,8 +852,15 @@ eom values << th.value rescue Exception errs << [th, $!] + th = nil end end + values + ensure + if th&.alive? + th.raise(Timeout::Error.new) + th.join rescue errs << [th, $!] + end if !errs.empty? msg = "exceptions on #{errs.length} threads:\n" + errs.map {|t, err| @@ -865,7 +872,6 @@ eom end raise MiniTest::Assertion, msg end - values end class << (AssertFile = Struct.new(:failure_message).new)