summaryrefslogtreecommitdiff
path: root/test/-ext-/symbol/test_inadvertent_creation.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-04-04 05:37:21 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-04-04 05:37:21 +0000
commit80748440654f93d40a97d0f4fb287f5d268c7cfd (patch)
treeaedc888d820184526efa990a26affb7688658bce /test/-ext-/symbol/test_inadvertent_creation.rb
parentf00035a4f7842b9cccbb43fc65d567ca2630d742 (diff)
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/test_inadvertent_creation.rb')
-rw-r--r--test/-ext-/symbol/test_inadvertent_creation.rb28
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