diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-04-04 05:37:21 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-04-04 05:37:21 +0000 |
commit | 80748440654f93d40a97d0f4fb287f5d268c7cfd (patch) | |
tree | aedc888d820184526efa990a26affb7688658bce /test/-ext-/symbol | |
parent | f00035a4f7842b9cccbb43fc65d567ca2630d742 (diff) | |
download | ruby-80748440654f93d40a97d0f4fb287f5d268c7cfd.tar.gz |
thread.c: avoid inadvertent symbol creation
* thread.c (rb_thread_aref): avoid inadvertent symbol creation.
(rb_thread_variable_get): ditto.
(rb_thread_key_p): ditto.
(rb_thread_variable_p): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40096 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/-ext-/symbol')
-rw-r--r-- | test/-ext-/symbol/test_inadvertent_creation.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/-ext-/symbol/test_inadvertent_creation.rb b/test/-ext-/symbol/test_inadvertent_creation.rb index 7c0aaa89f0..96a0dafc4b 100644 --- a/test/-ext-/symbol/test_inadvertent_creation.rb +++ b/test/-ext-/symbol/test_inadvertent_creation.rb @@ -159,5 +159,33 @@ module Test_Symbol assert_equal(name, e.name) assert_equal([Feature5112], e.args) end + + def test_thread_aref + Thread.current[:test] = nil + name = noninterned_name + assert_nil(Thread.current[name]) + assert_not_send([Bug::Symbol, :interned?, name]) + end + + def test_thread_key? + Thread.current[:test] = nil + name = noninterned_name + assert_not_send([Thread.current, :key?, name]) + assert_not_send([Bug::Symbol, :interned?, name]) + end + + def test_thread_variable_get + Thread.current.thread_variable_set(:test, nil) + name = noninterned_name + assert_nil(Thread.current.thread_variable_get(name)) + assert_not_send([Bug::Symbol, :interned?, name]) + end + + def test_thread_variable? + Thread.current.thread_variable_set(:test, nil) + name = noninterned_name + assert_not_send([Thread.current, :thread_variable?, name]) + assert_not_send([Bug::Symbol, :interned?, name]) + end end end |