From 6bbed0e31b1d32808443b3dd3e451aad28d46096 Mon Sep 17 00:00:00 2001 From: naruse Date: Sat, 12 Sep 2009 17:00:51 +0000 Subject: [PATCH] * test: use require_relative. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24878 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/drb/drbtest.rb | 8 +------- test/openssl/test_pair.rb | 5 +---- test/openssl/test_ssl.rb | 10 ++-------- test/rubygems/test_kernel.rb | 2 +- test/stringio/test_stringio.rb | 5 +---- test/test_syslog.rb | 4 ---- test/webrick/utils.rb | 8 +------- 7 files changed, 7 insertions(+), 35 deletions(-) diff --git a/test/drb/drbtest.rb b/test/drb/drbtest.rb index e1d3aeedf2..c89f51f47b 100644 --- a/test/drb/drbtest.rb +++ b/test/drb/drbtest.rb @@ -2,13 +2,7 @@ require 'test/unit' require 'drb/drb' require 'drb/extservm' require 'timeout' -begin - loadpath = $:.dup - $:.replace($: | [File.expand_path("../ruby", File.dirname(__FILE__))]) - require 'envutil' -ensure - $:.replace(loadpath) -end +require_relative '../ruby/envutil' class DRbService @@manager = DRb::ExtServManager.new diff --git a/test/openssl/test_pair.rb b/test/openssl/test_pair.rb index fb0662f501..d25a59b740 100644 --- a/test/openssl/test_pair.rb +++ b/test/openssl/test_pair.rb @@ -7,10 +7,7 @@ require 'test/unit' if defined?(OpenSSL) require 'socket' -dir = File.expand_path(__FILE__) -2.times {dir = File.dirname(dir)} -$:.replace([File.join(dir, "ruby")] | $:) -require 'ut_eof' +require_relative '../ruby/ut_eof' module SSLPair def server diff --git a/test/openssl/test_ssl.rb b/test/openssl/test_ssl.rb index 4688552cd3..e86b82110b 100644 --- a/test/openssl/test_ssl.rb +++ b/test/openssl/test_ssl.rb @@ -1,18 +1,12 @@ begin require "openssl" - require File.join(File.dirname(__FILE__), "utils.rb") + require_relative "utils.rb" rescue LoadError end require "rbconfig" require "socket" require "test/unit" -begin - loadpath = $:.dup - $:.replace($: | [File.expand_path("../ruby", File.dirname(__FILE__))]) - require 'envutil' -ensure - $:.replace(loadpath) -end +require_relative '../ruby/envutil' if defined?(OpenSSL) diff --git a/test/rubygems/test_kernel.rb b/test/rubygems/test_kernel.rb index 9dd63b85d7..0b2e8026a8 100644 --- a/test/rubygems/test_kernel.rb +++ b/test/rubygems/test_kernel.rb @@ -4,7 +4,7 @@ # See LICENSE.txt for permissions. #++ -require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities') +require_relative 'gemutilities' require 'rubygems/package' class TestKernel < RubyGemTestCase diff --git a/test/stringio/test_stringio.rb b/test/stringio/test_stringio.rb index 570f180fc7..df292e8a89 100644 --- a/test/stringio/test_stringio.rb +++ b/test/stringio/test_stringio.rb @@ -1,9 +1,6 @@ require 'test/unit' require 'stringio' -dir = File.expand_path(__FILE__) -2.times {dir = File.dirname(dir)} -$:.replace([File.join(dir, "ruby")] | $:) -require 'ut_eof' +require_relative '../ruby/ut_eof' class TestStringIO < Test::Unit::TestCase include TestEOF diff --git a/test/test_syslog.rb b/test/test_syslog.rb index 7b3efb85aa..e9fc375c90 100644 --- a/test/test_syslog.rb +++ b/test/test_syslog.rb @@ -6,10 +6,6 @@ # If in doubt, ask your admin. require 'test/unit' - -# Prepend current directory to load path for testing. -$:.unshift('.') - require 'syslog' class TestSyslog < Test::Unit::TestCase diff --git a/test/webrick/utils.rb b/test/webrick/utils.rb index 82df9cde69..ebc936cb2c 100644 --- a/test/webrick/utils.rb +++ b/test/webrick/utils.rb @@ -1,10 +1,4 @@ -begin - loadpath = $:.dup - $:.replace($: | [File.expand_path("../ruby", File.dirname(__FILE__))]) - require 'envutil' -ensure - $:.replace(loadpath) -end +require_relative '../ruby/envutil' require "webrick" begin require "webrick/https"