From 604f8be1571b9b0857c86a8c963f2d96fa8b92ba Mon Sep 17 00:00:00 2001 From: usa Date: Fri, 11 Nov 2016 22:33:21 +0000 Subject: 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 --- test/ruby/test_thread.rb | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'test') 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 -- cgit v1.2.3