From 6bab4ea9917dc05cd2c94aead2e96eb7df7d4be1 Mon Sep 17 00:00:00 2001 From: shyouhei Date: Wed, 15 Sep 2010 06:01:00 +0000 Subject: * lib/test/unit/assertions.rb (Test::Unit::Assertions::assert_nothing_raised): should properly ignore MiniTest::Skip * lib/minitest/unit.rb (MiniTest::Assertions::assert_raises): ditto. * test/net/imap/test_imap.rb: Properly skip SSL tests when localhost is not 127.0.0.1. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29259 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 11 +++++++++++ lib/minitest/unit.rb | 2 ++ lib/test/unit/assertions.rb | 2 ++ test/net/imap/test_imap.rb | 22 ++++++++++++++++------ 4 files changed, 31 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 949a699fcb..0da9b14cb6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +Wed Sep 15 14:59:49 2010 URABE Shyouhei + + * lib/test/unit/assertions.rb (Test::Unit::Assertions::assert_nothing_raised): + should properly ignore MiniTest::Skip + + * lib/minitest/unit.rb (MiniTest::Assertions::assert_raises): + ditto. + + * test/net/imap/test_imap.rb: Properly skip SSL tests when + localhost is not 127.0.0.1. + Wed Sep 15 13:37:00 2010 URABE Shyouhei * test/net/imap/test_imap.rb: "localhost" not guaranteed to diff --git a/lib/minitest/unit.rb b/lib/minitest/unit.rb index c45dec3fc4..28e14498a4 100644 --- a/lib/minitest/unit.rb +++ b/lib/minitest/unit.rb @@ -222,6 +222,8 @@ module MiniTest begin yield should_raise = true + rescue MiniTest::Skip + raise rescue Exception => e details = "#{msg}#{mu_pp(exp)} exception expected, not" assert(exp.any? { |ex| diff --git a/lib/test/unit/assertions.rb b/lib/test/unit/assertions.rb index f4e4e74e1e..6e4707fc25 100644 --- a/lib/test/unit/assertions.rb +++ b/lib/test/unit/assertions.rb @@ -32,6 +32,8 @@ module Test end begin line = __LINE__; yield + rescue MiniTest::Skip + raise rescue Exception => e bt = e.backtrace as = e.instance_of?(MiniTest::Assertion) diff --git a/test/net/imap/test_imap.rb b/test/net/imap/test_imap.rb index 06ecca0f00..8ccec642c0 100644 --- a/test/net/imap/test_imap.rb +++ b/test/net/imap/test_imap.rb @@ -49,9 +49,13 @@ class IMAPTest < Test::Unit::TestCase if defined?(OpenSSL) assert_raise(OpenSSL::SSL::SSLError) do imaps_test do |port| - Net::IMAP.new("localhost", - :port => port, - :ssl => true) + begin + Net::IMAP.new("localhost", + :port => port, + :ssl => true) + rescue SystemCallError + skip $! + end end end end @@ -61,9 +65,13 @@ class IMAPTest < Test::Unit::TestCase if defined?(OpenSSL) assert_nothing_raised do imaps_test do |port| - Net::IMAP.new("localhost", - :port => port, - :ssl => { :ca_file => CA_FILE }) + begin + Net::IMAP.new("localhost", + :port => port, + :ssl => { :ca_file => CA_FILE }) + rescue SystemCallError + skip $! + end end end end @@ -104,6 +112,8 @@ class IMAPTest < Test::Unit::TestCase imap end end + rescue SystemCallError + skip $! ensure if imap && !imap.disconnected? imap.disconnect -- cgit v1.2.3