From 310e91f505b6d1658fde8beb17861180aedca6c8 Mon Sep 17 00:00:00 2001 From: kazu Date: Mon, 9 Oct 2017 11:20:00 +0000 Subject: [PATCH] Remove unused test files related `$SAFE>=2` unused since r14024 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60143 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/drb/drbtest.rb | 2 +- test/drb/test_drb.rb | 49 -------------------------------------------- test/drb/ut_eval.rb | 37 --------------------------------- 3 files changed, 1 insertion(+), 87 deletions(-) delete mode 100644 test/drb/ut_eval.rb diff --git a/test/drb/drbtest.rb b/test/drb/drbtest.rb index cc7063c39e..2796100280 100644 --- a/test/drb/drbtest.rb +++ b/test/drb/drbtest.rb @@ -15,7 +15,7 @@ class DRbService DRb::ExtServManager.command[nm] = @@ruby + ["#{dir}/#{nm}"] end - %w(ut_drb.rb ut_array.rb ut_port.rb ut_large.rb ut_safe1.rb ut_eval.rb ut_eq.rb).each do |nm| + %w(ut_drb.rb ut_array.rb ut_port.rb ut_large.rb ut_safe1.rb ut_eq.rb).each do |nm| add_service_command(nm) end @server = @@server = DRb::DRbServer.new('druby://localhost:0', @@manager, {}) diff --git a/test/drb/test_drb.rb b/test/drb/test_drb.rb index ec9d306290..52e79ea496 100644 --- a/test/drb/test_drb.rb +++ b/test/drb/test_drb.rb @@ -240,55 +240,6 @@ class TestDRbSafe1 < TestDRbAry end end -class TestDRbEval # < Test::Unit::TestCase - def setup - super - @ext = DRbService.ext_service('ut_eval.rb') - @there = @ext.front - end - - def teardown - @ext.stop_service if @ext - end - - def test_01_safe1_safe4_eval - assert_raise(SecurityError) do - @there.method_missing(:instance_eval, 'ENV.inspect') - end - - assert_raise(SecurityError) do - @there.method_missing(:send, :eval, 'ENV.inspect') - end - - remote_class = @there.remote_class - - assert_raise(SecurityError) do - remote_class.class_eval('ENV.inspect') - end - - assert_raise(SecurityError) do - remote_class.module_eval('ENV.inspect') - end - - four = @there.four - assert_equal(1, four.method_missing(:send, :eval, '1')) - - remote_class = four.remote_class - - assert_equal(1, remote_class.class_eval('1')) - - assert_equal(1, remote_class.module_eval('1')) - - assert_raise(SecurityError) do - remote_class.class_eval('ENV = {}') - end - - assert_raise(SecurityError) do - remote_class.module_eval('ENV = {}') - end - end -end - class TestDRbLarge < Test::Unit::TestCase include DRbBase diff --git a/test/drb/ut_eval.rb b/test/drb/ut_eval.rb deleted file mode 100644 index 0a81b40b0e..0000000000 --- a/test/drb/ut_eval.rb +++ /dev/null @@ -1,37 +0,0 @@ -# frozen_string_literal: false -require 'drb/drb' -require 'drb/extserv' - -module DRbTests - -class EvalAttack - def initialize - @four = DRb::DRbServer.new('druby://localhost:0', self, {:safe_level => 4}) - end - - def four - DRbObject.new_with_uri(@four.uri) - end - - def remote_class - DRbObject.new(self.class) - end -end - -end - - -if __FILE__ == $0 - def ARGV.shift - it = super() - raise "usage: #{$0} " unless it - it - end - - $SAFE = 1 - - DRb.start_service('druby://localhost:0', DRbTests::EvalAttack.new, {:safe_level => 2}) - es = DRb::ExtServ.new(ARGV.shift, ARGV.shift) - DRb.thread.join - es.stop_service if es.alive? -end