summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-04-15 12:12:25 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-04-15 12:12:25 +0000
commitf7d0059e3643ad1713b8abe4969147e2bc185d75 (patch)
treeb65f21bbab7fbc8f4a291beb7950ab1a412cce53 /test/ruby
parent589169cb78ca8dfaaa3d9cacf71dc34bd81265f2 (diff)
thread.c: must be initialized to set name
* thread.c (get_initialized_threadptr): extract ensuring that the thread is initialized. * thread.c (rb_thread_setname): thread must be initialized to set the name. [ruby-core:74963] [Bug #12290] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54598 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_thread.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/ruby/test_thread.rb b/test/ruby/test_thread.rb
index ca162f152f..05bb536111 100644
--- a/test/ruby/test_thread.rb
+++ b/test/ruby/test_thread.rb
@@ -1098,4 +1098,10 @@ q.pop
t.kill
t.join
end
+
+ def test_thread_setname_uninitialized
+ bug12290 = '[ruby-core:74963] [Bug #12290]'
+ c = Class.new(Thread) {def initialize() self.name = "foo" end}
+ assert_raise(ThreadError, bug12290) {c.new {}}
+ end
end