summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-11-05 02:44:06 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-11-05 02:44:06 +0000
commit564082796ac2372ff211ad927e32596ec665ad06 (patch)
tree58d4656a998ec20595bb2cf3dab5f2ec554f752a /test
parentd56ccddb31a3b64bb1fcfd2257c477f37a7d72f6 (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_3@56564 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 6ad33b83d4..97643947ad 100644
--- a/test/ruby/test_thread.rb
+++ b/test/ruby/test_thread.rb
@@ -748,9 +748,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