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 | dac5cb455fb7b163bbe21c941d63cc714a53e7de (patch) | |
tree | ff8deb87b4be7b457bee53432dfad918aa3376a8 /test | |
parent | 59227ffaafae81e4a2a9a6bf78741225c47b102e (diff) | |
download | ruby-dac5cb455fb7b163bbe21c941d63cc714a53e7de.tar.gz |
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 |