1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

On some platforms, object_id can be negative value like NetBSD.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33597 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2011-11-01 00:42:41 +00:00
parent 5dbc3d1e79
commit 632f448827

View file

@ -4,7 +4,7 @@ require "-test-/symbol/symbol"
module Test_Symbol
class TestInadvertent < Test::Unit::TestCase
def noninterned_name(prefix = "")
prefix += "_#{Thread.current.object_id.to_s(36)}"
prefix += "_#{Thread.current.object_id.to_s(36).tr('-', '_')}"
begin
name = "#{prefix}_#{rand(0x1000).to_s(16)}_#{Time.now.usec}"
end while Bug::Symbol.interned?(name)