summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog12
-rw-r--r--lib/test/unit/collector/dir.rb1
-rw-r--r--test/drb/drbtest.rb17
-rw-r--r--test/drb/test_drb.rb3
-rw-r--r--test/drb/test_drbssl.rb6
-rw-r--r--test/drb/test_drbunix.rb7
-rw-r--r--test/ruby/test_beginendblock.rb3
-rw-r--r--test/ruby/test_system.rb3
8 files changed, 36 insertions, 16 deletions
diff --git a/ChangeLog b/ChangeLog
index e2c6becdc5e..5fd5a7604fc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+Wed Oct 22 12:53:31 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/test/unit/collector/dir.rb (Test::Unit::Collector::Dir#collect_file):
+ ignore tests which raised LoadError.
+
+ * test/drb/drbtest.rb, test/ruby/test_beginendblock.rb,
+ test/ruby/test_system.rb: avoid requiring same file twice.
+
+ * test/drb/test_drbssl.rb, test/drb/test_drbunix.rb: should not use
+ ARGV unless invoked directly. do not create test cases unless
+ required libraries are available.
+
Wed Oct 22 02:31:34 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c (ruby_cleanup): should not ignore exit_value in END
diff --git a/lib/test/unit/collector/dir.rb b/lib/test/unit/collector/dir.rb
index 7a9bde891b9..c4a4c16dfd8 100644
--- a/lib/test/unit/collector/dir.rb
+++ b/lib/test/unit/collector/dir.rb
@@ -75,6 +75,7 @@ module Test
require(name)
end
find_test_cases(already_gathered).each{|t| add_suite(suites, t.suite)}
+ rescue LoadError, SystemExit
ensure
$:.replace(loadpath)
end
diff --git a/test/drb/drbtest.rb b/test/drb/drbtest.rb
index 5cdcd25dfdc..cc3c4d4346f 100644
--- a/test/drb/drbtest.rb
+++ b/test/drb/drbtest.rb
@@ -1,10 +1,9 @@
-require "#{File.dirname(File.expand_path(__FILE__))}/drbtest"
require 'test/unit'
require 'drb/drb'
require 'drb/extservm'
require 'timeout'
-
-require "#{File.dirname(File.expand_path(__FILE__))}/../ruby/envutil"
+$:.unshift(File.expand_path("../../ruby", __FILE__))
+require 'envutil'
class DRbService
@@manager = DRb::ExtServManager.new
@@ -68,11 +67,11 @@ module DRbCore
ro = DRbObject.new(nil, 'druby://localhost:12345')
assert_equal('druby://localhost:12345', ro.__drburi)
assert_equal(nil, ro.__drbref)
-
+
ro = DRbObject.new_with_uri('druby://localhost:12345')
assert_equal('druby://localhost:12345', ro.__drburi)
assert_equal(nil, ro.__drbref)
-
+
ro = DRbObject.new_with_uri('druby://localhost:12345?foobar')
assert_equal('druby://localhost:12345', ro.__drburi)
assert_equal(DRb::DRbURIOption.new('foobar'), ro.__drbref)
@@ -88,7 +87,7 @@ module DRbCore
def test_01_02_loop
onecky = Onecky.new('3')
- 50.times do
+ 50.times do
assert_equal(6, @there.sample(onecky, 1, 2))
ary = @there.to_a
assert_kind_of(DRb::DRbObject, ary)
@@ -166,14 +165,14 @@ module DRbCore
begin
@there.method_missing(:eval)
rescue NameError
- assert_match(/^private method `eval'/, $!.message)
+ assert_match(/^private method \`eval\'/, $!.message)
end
}
assert_nothing_raised() {
begin
@there.method_missing(:undefined_method_test)
rescue NameError
- assert_match(/^undefined method `undefined_method_test'/, $!.message)
+ assert_match(/^undefined method \`undefined_method_test\'/, $!.message)
end
}
assert_raises(SecurityError) do
@@ -184,7 +183,7 @@ module DRbCore
def test_08_here
ro = DRbObject.new(nil, DRb.uri)
assert_kind_of(String, ro.to_s)
-
+
ro = DRbObject.new_with_uri(DRb.uri)
assert_kind_of(String, ro.to_s)
end
diff --git a/test/drb/test_drb.rb b/test/drb/test_drb.rb
index 213c70f95da..a3c259b7a5b 100644
--- a/test/drb/test_drb.rb
+++ b/test/drb/test_drb.rb
@@ -1,4 +1,5 @@
-require "#{File.dirname(File.expand_path(__FILE__))}/drbtest"
+$:.unshift(File.dirname(File.expand_path(__FILE__)))
+require 'drbtest'
class TestDRbCore < Test::Unit::TestCase
include DRbCore
diff --git a/test/drb/test_drbssl.rb b/test/drb/test_drbssl.rb
index 6e2e0b1746f..0ca177fe582 100644
--- a/test/drb/test_drbssl.rb
+++ b/test/drb/test_drbssl.rb
@@ -1,4 +1,5 @@
-require "#{File.dirname(File.expand_path(__FILE__))}/drbtest"
+$:.unshift(File.dirname(File.expand_path(__FILE__)))
+require 'drbtest'
require 'drb/ssl'
class DRbSSLService < DRbService
@@ -22,7 +23,8 @@ class DRbSSLService < DRbService
[ ["C","JP"], ["O","Foo.DRuby.Org"], ["CN", "Sample"] ]
end
- @server = DRb::DRbServer.new(ARGV.shift || 'drbssl://:0', @@manager, config)
+ uri = ARGV.shift if $0 == __FILE__
+ @server = DRb::DRbServer.new(uri || 'drbssl://:0', @@manager, config)
end
class TestDRbSSLCore < Test::Unit::TestCase
diff --git a/test/drb/test_drbunix.rb b/test/drb/test_drbunix.rb
index 1aaaffe359a..e05637a2b78 100644
--- a/test/drb/test_drbunix.rb
+++ b/test/drb/test_drbunix.rb
@@ -1,11 +1,14 @@
-require "#{File.dirname(File.expand_path(__FILE__))}/drbtest"
+$:.unshift(File.dirname(File.expand_path(__FILE__)))
+require 'drbtest'
require 'drb/unix'
class DRbUNIXService < DRbService
%w(ut_drb_drbunix.rb ut_array_drbunix.rb).each do |nm|
DRb::ExtServManager.command[nm] = "#{@@ruby} #{@@dir}/#{nm}"
end
- @server = DRb::DRbServer.new(ARGV.shift || 'drbunix:', @@manager, {})
+
+ uri = ARGV.shift if $0 == __FILE__
+ @server = DRb::DRbServer.new(uri || 'drbunix:', @@manager, {})
end
class TestDRbUNIXCore < Test::Unit::TestCase
diff --git a/test/ruby/test_beginendblock.rb b/test/ruby/test_beginendblock.rb
index deacc782b7e..e8d25a102d5 100644
--- a/test/ruby/test_beginendblock.rb
+++ b/test/ruby/test_beginendblock.rb
@@ -1,6 +1,7 @@
require 'test/unit'
require 'tempfile'
-require "#{File.dirname(File.expand_path(__FILE__))}/envutil"
+$:.unshift(File.dirname(File.expand_path(__FILE__)))
+require 'envutil'
class TestBeginEndBlock < Test::Unit::TestCase
DIR = File.dirname(File.expand_path(__FILE__))
diff --git a/test/ruby/test_system.rb b/test/ruby/test_system.rb
index da4deb5a044..ed7f8b8fd15 100644
--- a/test/ruby/test_system.rb
+++ b/test/ruby/test_system.rb
@@ -1,5 +1,6 @@
require 'test/unit'
-require "#{File.dirname(File.expand_path(__FILE__))}/envutil"
+$:.unshift(File.dirname(File.expand_path(__FILE__)))
+require 'envutil'
$KCODE = 'none'