diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-05-18 09:41:21 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-05-18 09:41:21 +0000 |
commit | 058823440d95446813d10afaf8ef79394bda386f (patch) | |
tree | ff8deb87b4be7b457bee53432dfad918aa3376a8 /test | |
parent | bd40bd33934cb7ccdc4ee5a3f7a0df0323619370 (diff) |
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
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_autoload.rb | 12 |
1 files 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 |