From 058823440d95446813d10afaf8ef79394bda386f Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 18 May 2015 09:41:21 +0000 Subject: [PATCH] test_autoload.rb: use class_eval * test/ruby/test_autoload.rb (add_autoload): use class_eval instead of string eval. * test/ruby/test_autoload.rb (remove_autoload_constant): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50529 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_autoload.rb | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/test/ruby/test_autoload.rb b/test/ruby/test_autoload.rb index 018cc1c326..ed731388cd 100644 --- a/test/ruby/test_autoload.rb +++ b/test/ruby/test_autoload.rb @@ -214,19 +214,11 @@ p Foo::Bar def add_autoload(path) (@autoload_paths ||= []) << path - eval <<-END - class ::Object - autoload :AutoloadTest, #{path.dump} - end - END + ::Object.class_eval {autoload(:AutoloadTest, path)} end def remove_autoload_constant $".replace($" - @autoload_paths) - eval <<-END - class ::Object - remove_const(:AutoloadTest) - end - END + ::Object.class_eval {remove_const(:AutoloadTest)} end end