File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change 61
61
} . should raise_error ( RuntimeError , "Thread#report_on_exception specs" )
62
62
end
63
63
64
+ ruby_version_is "3.0" do
65
+ it "prints a backtrace on $stderr in the regular backtrace order" do
66
+ line_raise = __LINE__ + 2
67
+ def foo
68
+ raise RuntimeError , "Thread#report_on_exception specs backtrace order"
69
+ end
70
+
71
+ line_call_foo = __LINE__ + 5
72
+ go = false
73
+ t = Thread . new {
74
+ Thread . current . report_on_exception = true
75
+ Thread . pass until go
76
+ foo
77
+ }
78
+
79
+ -> {
80
+ go = true
81
+ Thread . pass while t . alive?
82
+ } . should output ( "" , <<ERR )
83
+ #{ t . inspect } terminated with exception (report_on_exception is true):
84
+ #{ __FILE__ } :#{ line_raise } :in `foo': Thread#report_on_exception specs backtrace order (RuntimeError)
85
+ \t from #{ __FILE__ } :#{ line_call_foo } :in `block (5 levels) in <top (required)>'
86
+ ERR
87
+
88
+ -> {
89
+ t . join
90
+ } . should raise_error ( RuntimeError , "Thread#report_on_exception specs backtrace order" )
91
+ end
92
+ end
93
+
64
94
it "prints the backtrace even if the thread was killed just after Thread#raise" do
65
95
t = nil
66
96
ready = false
You can’t perform that action at this time.
0 commit comments