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

test_inadvertent_creation.rb: use Symbol.find

* ext/-test-/symbol/intern.c: Symbol.find is available now.

* test/-ext-/symbol/test_inadvertent_creation.rb (noninterned_name):
  use Symbol.find instead.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45763 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2014-04-30 15:16:07 +00:00
parent 60375cd6ba
commit b522335554
2 changed files with 2 additions and 16 deletions

View file

@ -1,14 +0,0 @@
#include "ruby.h"
static VALUE
bug_sym_interned_p(VALUE self, VALUE name)
{
ID id = rb_check_id(&name);
return id ? Qtrue : Qfalse;
}
void
Init_intern(VALUE klass)
{
rb_define_singleton_method(klass, "interned?", bug_sym_interned_p, 1);
}

View file

@ -7,7 +7,7 @@ module Test_Symbol
prefix += "_#{Thread.current.object_id.to_s(36).tr('-', '_')}" prefix += "_#{Thread.current.object_id.to_s(36).tr('-', '_')}"
begin begin
name = "#{prefix}_#{rand(0x1000).to_s(16)}_#{Time.now.usec}" name = "#{prefix}_#{rand(0x1000).to_s(16)}_#{Time.now.usec}"
end while Bug::Symbol.interned?(name) end while ::Symbol.find(name)
name name
end end
@ -16,7 +16,7 @@ module Test_Symbol
end end
def assert_not_interned(name, msg = nil) def assert_not_interned(name, msg = nil)
assert_not_send([Bug::Symbol, :interned?, name], msg) assert_not_send([::Symbol, :find, name], msg)
end end
def assert_not_interned_error(obj, meth, name, msg = nil) def assert_not_interned_error(obj, meth, name, msg = nil)