summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-03-10 02:32:56 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-03-10 02:32:56 +0000
commit3c35067cfc20c510f26d16466015d2195736801b (patch)
tree0b413ba08cc79db1243d83a6f989a88d5ad29f11 /test/ruby
parentacbf49de470c03cd5071ac563127572c89c1caeb (diff)
merge revision(s) 59963: [Backport #13163]
thread.c: report then abort * thread.c (thread_start_func_2): report then abort on exception, if both are set. [ruby-core:79280] [Bug #13163] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@62711 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_thread.rb16
1 files changed, 15 insertions, 1 deletions
diff --git a/test/ruby/test_thread.rb b/test/ruby/test_thread.rb
index 43aae09d7d..52d46dc7a3 100644
--- a/test/ruby/test_thread.rb
+++ b/test/ruby/test_thread.rb
@@ -353,7 +353,8 @@ class TestThread < Test::Unit::TestCase
end
def test_report_on_exception
- assert_separately([], <<~"end;") #do
+ assert_separately([], "#{<<~"begin;"}\n#{<<~'end;'}")
+ begin;
q1 = Thread::Queue.new
q2 = Thread::Queue.new
@@ -405,6 +406,19 @@ class TestThread < Test::Unit::TestCase
assert_equal(true, q1.pop)
Thread.pass while th.alive?
}
+
+ assert_warn(/report 5/, "should defaults to the global flag at the start") {
+ th = Thread.start {
+ Thread.current.report_on_exception = true
+ Thread.current.abort_on_exception = true
+ q2.pop
+ raise "report 5"
+ }
+ assert_raise_with_message(RuntimeError, "report 5") {
+ q2.push(true)
+ Thread.pass while th.alive?
+ }
+ }
end;
end