summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-11-11 22:33:21 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-11-11 22:33:21 +0000
commit604f8be1571b9b0857c86a8c963f2d96fa8b92ba (patch)
tree7bb942fc76a59124e3f148d3b047987eba110116 /test
parent04b031656add2a8c9f7f2136e4fc7fc16c9ac901 (diff)
merge revision(s) 53449: [Backport #11959]
* thread.c (rb_thread_pending_interrupt_p): no pending interrupt before initialization. * thread.c (thread_raise_m, rb_thread_kill): uninitialized thread cannot interrupt. [ruby-core:72732] [Bug #11959] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@56726 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_thread.rb19
1 files changed, 17 insertions, 2 deletions
diff --git a/test/ruby/test_thread.rb b/test/ruby/test_thread.rb
index 87d5f0f79e..1ef6dadf2b 100644
--- a/test/ruby/test_thread.rb
+++ b/test/ruby/test_thread.rb
@@ -744,9 +744,24 @@ _eom
end
def test_uninitialized
- c = Class.new(Thread)
- c.class_eval { def initialize; end }
+ c = Class.new(Thread) {def initialize; end}
assert_raise(ThreadError) { c.new.start }
+
+ bug11959 = '[ruby-core:72732] [Bug #11959]'
+
+ c = Class.new(Thread) {def initialize; exit; end}
+ assert_raise(ThreadError, bug11959) { c.new }
+
+ c = Class.new(Thread) {def initialize; raise; end}
+ assert_raise(ThreadError, bug11959) { c.new }
+
+ c = Class.new(Thread) {
+ def initialize
+ pending = pending_interrupt?
+ super {pending}
+ end
+ }
+ assert_equal(false, c.new.value, bug11959)
end
def test_backtrace