aboutsummaryrefslogtreecommitdiffstats
path: root/spec/ruby/core/thread
diff options
context:
space:
mode:
authorBenoit Daloze <eregontp@gmail.com>2022-03-03 14:43:14 +0100
committerBenoit Daloze <eregontp@gmail.com>2022-03-03 14:43:14 +0100
commit3b21818db1fac0c22f16364eab2d8cc0067abd63 (patch)
tree6776a6bfe92db4e35da1ff01e09c40d4c4c20351 /spec/ruby/core/thread
parent1dc6bed0ca6ca379f1c4b2e9fc0dee72dbf1e205 (diff)
downloadruby-3b21818db1fac0c22f16364eab2d8cc0067abd63.tar.gz
Update to ruby/spec@82cd3a3
Diffstat (limited to 'spec/ruby/core/thread')
-rw-r--r--spec/ruby/core/thread/report_on_exception_spec.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/ruby/core/thread/report_on_exception_spec.rb b/spec/ruby/core/thread/report_on_exception_spec.rb
index bf50a167df..e7f400819a 100644
--- a/spec/ruby/core/thread/report_on_exception_spec.rb
+++ b/spec/ruby/core/thread/report_on_exception_spec.rb
@@ -60,6 +60,27 @@ describe "Thread#report_on_exception=" do
t.join
}.should raise_error(RuntimeError, "Thread#report_on_exception specs")
end
+
+ it "prints the backtrace even if the thread was killed just after Thread#raise" do
+ t = nil
+ ready = false
+ -> {
+ t = Thread.new {
+ Thread.current.report_on_exception = true
+ ready = true
+ sleep
+ }
+
+ Thread.pass until ready and t.stop?
+ t.raise RuntimeError, "Thread#report_on_exception before kill spec"
+ t.kill
+ Thread.pass while t.alive?
+ }.should output("", /Thread.+terminated with exception.+Thread#report_on_exception before kill spec/m)
+
+ -> {
+ t.join
+ }.should raise_error(RuntimeError, "Thread#report_on_exception before kill spec")
+ end
end
describe "when set to false" do