diff options
-rwxr-xr-x | test/csv/test_features.rb | 9 | ||||
-rw-r--r-- | test/open-uri/test_open-uri.rb | 7 | ||||
-rw-r--r-- | test/rexml/test_order.rb | 7 |
3 files changed, 16 insertions, 7 deletions
diff --git a/test/csv/test_features.rb b/test/csv/test_features.rb index 33166e8d77..1c178d130d 100755 --- a/test/csv/test_features.rb +++ b/test/csv/test_features.rb @@ -7,7 +7,10 @@ # Copyright 2005 James Edward Gray II. You can redistribute or modify this code # under the terms of Ruby's license. -require "zlib" +begin + require "zlib" +rescue LoadError +end require_relative "base" @@ -205,7 +208,7 @@ class TestCSV::Features < TestCSV ) end assert_equal("\r\n", zipped.row_sep) - end + end if defined?(Zlib::GzipReader) def test_gzip_writer_bug_fix tempfile = Tempfile.new(%w"temp .gz") @@ -223,7 +226,7 @@ class TestCSV::Features < TestCSV include?($INPUT_RECORD_SEPARATOR), "@row_sep did not default" ) tempfile.close(true) - end + end if defined?(Zlib::GzipWriter) def test_inspect_is_smart_about_io_types str = CSV.new("string,data").inspect diff --git a/test/open-uri/test_open-uri.rb b/test/open-uri/test_open-uri.rb index 0cae2d56fd..2b0cfc622f 100644 --- a/test/open-uri/test_open-uri.rb +++ b/test/open-uri/test_open-uri.rb @@ -2,7 +2,10 @@ require 'test/unit' require 'open-uri' require 'webrick' require 'webrick/httpproxy' -require 'zlib' +begin + require 'zlib' +rescue LoadError +end class TestOpenURI < Test::Unit::TestCase @@ -497,7 +500,7 @@ class TestOpenURI < Test::Unit::TestCase assert_equal(content_gz, f.read.force_encoding("ascii-8bit")) } } - end + end if defined?(Zlib::GzipWriter) # 192.0.2.0/24 is TEST-NET. [RFC3330] diff --git a/test/rexml/test_order.rb b/test/rexml/test_order.rb index a87b1c2728..3f874c2052 100644 --- a/test/rexml/test_order.rb +++ b/test/rexml/test_order.rb @@ -1,6 +1,9 @@ require 'rexml_test_utils' require 'rexml/document' -require 'zlib' +begin + require 'zlib' +rescue LoadError +end class OrderTester < Test::Unit::TestCase include REXMLTestUtils @@ -98,5 +101,5 @@ END assert_equal( actual[count], n ) unless n =~ /Arrive at/ count += 1 } - end + end if defined?(Zlib::GzipReader) end |