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

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
This commit is contained in:
nobu 2015-05-18 09:41:21 +00:00
parent bd40bd3393
commit 058823440d

View file

@ -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