summaryrefslogtreecommitdiff
path: root/spec/rubyspec/library/zlib
diff options
context:
space:
mode:
authoreregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-09-20 20:18:52 +0000
committereregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-09-20 20:18:52 +0000
commit1d15d5f08032acf1b7bceacbb450d617ff6e0931 (patch)
treea3785a79899302bc149e4a6e72f624ac27dc1f10 /spec/rubyspec/library/zlib
parent75bfc6440d595bf339007f4fb280fd4d743e89c1 (diff)
Move spec/rubyspec to spec/ruby for consistency
* Other ruby implementations use the spec/ruby directory. [Misc #13792] [ruby-core:82287] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec/rubyspec/library/zlib')
-rw-r--r--spec/rubyspec/library/zlib/adler32_spec.rb46
-rw-r--r--spec/rubyspec/library/zlib/crc32_spec.rb52
-rw-r--r--spec/rubyspec/library/zlib/crc_table_spec.rb75
-rw-r--r--spec/rubyspec/library/zlib/deflate/append_spec.rb1
-rw-r--r--spec/rubyspec/library/zlib/deflate/deflate_spec.rb128
-rw-r--r--spec/rubyspec/library/zlib/deflate/flush_spec.rb1
-rw-r--r--spec/rubyspec/library/zlib/deflate/new_spec.rb1
-rw-r--r--spec/rubyspec/library/zlib/deflate/params_spec.rb17
-rw-r--r--spec/rubyspec/library/zlib/deflate/set_dictionary_spec.rb15
-rw-r--r--spec/rubyspec/library/zlib/gzipfile/close_spec.rb22
-rw-r--r--spec/rubyspec/library/zlib/gzipfile/closed_spec.rb17
-rw-r--r--spec/rubyspec/library/zlib/gzipfile/comment_spec.rb27
-rw-r--r--spec/rubyspec/library/zlib/gzipfile/crc_spec.rb1
-rw-r--r--spec/rubyspec/library/zlib/gzipfile/finish_spec.rb1
-rw-r--r--spec/rubyspec/library/zlib/gzipfile/level_spec.rb1
-rw-r--r--spec/rubyspec/library/zlib/gzipfile/mtime_spec.rb1
-rw-r--r--spec/rubyspec/library/zlib/gzipfile/orig_name_spec.rb27
-rw-r--r--spec/rubyspec/library/zlib/gzipfile/os_code_spec.rb1
-rw-r--r--spec/rubyspec/library/zlib/gzipfile/sync_spec.rb1
-rw-r--r--spec/rubyspec/library/zlib/gzipfile/to_io_spec.rb1
-rw-r--r--spec/rubyspec/library/zlib/gzipfile/wrap_spec.rb1
-rw-r--r--spec/rubyspec/library/zlib/gzipreader/each_byte_spec.rb51
-rw-r--r--spec/rubyspec/library/zlib/gzipreader/each_line_spec.rb5
-rw-r--r--spec/rubyspec/library/zlib/gzipreader/each_spec.rb5
-rw-r--r--spec/rubyspec/library/zlib/gzipreader/eof_spec.rb56
-rw-r--r--spec/rubyspec/library/zlib/gzipreader/getc_spec.rb41
-rw-r--r--spec/rubyspec/library/zlib/gzipreader/gets_spec.rb22
-rw-r--r--spec/rubyspec/library/zlib/gzipreader/lineno_spec.rb1
-rw-r--r--spec/rubyspec/library/zlib/gzipreader/new_spec.rb1
-rw-r--r--spec/rubyspec/library/zlib/gzipreader/open_spec.rb1
-rw-r--r--spec/rubyspec/library/zlib/gzipreader/pos_spec.rb27
-rw-r--r--spec/rubyspec/library/zlib/gzipreader/read_spec.rb68
-rw-r--r--spec/rubyspec/library/zlib/gzipreader/readchar_spec.rb1
-rw-r--r--spec/rubyspec/library/zlib/gzipreader/readline_spec.rb1
-rw-r--r--spec/rubyspec/library/zlib/gzipreader/readlines_spec.rb1
-rw-r--r--spec/rubyspec/library/zlib/gzipreader/readpartial_spec.rb17
-rw-r--r--spec/rubyspec/library/zlib/gzipreader/rewind_spec.rb48
-rw-r--r--spec/rubyspec/library/zlib/gzipreader/shared/each.rb51
-rw-r--r--spec/rubyspec/library/zlib/gzipreader/tell_spec.rb1
-rw-r--r--spec/rubyspec/library/zlib/gzipreader/ungetbyte_spec.rb122
-rw-r--r--spec/rubyspec/library/zlib/gzipreader/ungetc_spec.rb292
-rw-r--r--spec/rubyspec/library/zlib/gzipreader/unused_spec.rb1
-rw-r--r--spec/rubyspec/library/zlib/gzipwriter/append_spec.rb17
-rw-r--r--spec/rubyspec/library/zlib/gzipwriter/comment_spec.rb1
-rw-r--r--spec/rubyspec/library/zlib/gzipwriter/flush_spec.rb1
-rw-r--r--spec/rubyspec/library/zlib/gzipwriter/mtime_spec.rb38
-rw-r--r--spec/rubyspec/library/zlib/gzipwriter/new_spec.rb1
-rw-r--r--spec/rubyspec/library/zlib/gzipwriter/open_spec.rb1
-rw-r--r--spec/rubyspec/library/zlib/gzipwriter/orig_name_spec.rb1
-rw-r--r--spec/rubyspec/library/zlib/gzipwriter/pos_spec.rb1
-rw-r--r--spec/rubyspec/library/zlib/gzipwriter/print_spec.rb1
-rw-r--r--spec/rubyspec/library/zlib/gzipwriter/printf_spec.rb1
-rw-r--r--spec/rubyspec/library/zlib/gzipwriter/putc_spec.rb1
-rw-r--r--spec/rubyspec/library/zlib/gzipwriter/puts_spec.rb1
-rw-r--r--spec/rubyspec/library/zlib/gzipwriter/tell_spec.rb1
-rw-r--r--spec/rubyspec/library/zlib/gzipwriter/write_spec.rb36
-rw-r--r--spec/rubyspec/library/zlib/inflate/append_spec.rb60
-rw-r--r--spec/rubyspec/library/zlib/inflate/finish_spec.rb28
-rw-r--r--spec/rubyspec/library/zlib/inflate/inflate_spec.rb152
-rw-r--r--spec/rubyspec/library/zlib/inflate/new_spec.rb1
-rw-r--r--spec/rubyspec/library/zlib/inflate/set_dictionary_spec.rb21
-rw-r--r--spec/rubyspec/library/zlib/inflate/sync_point_spec.rb1
-rw-r--r--spec/rubyspec/library/zlib/inflate/sync_spec.rb1
-rw-r--r--spec/rubyspec/library/zlib/zlib_version_spec.rb1
-rw-r--r--spec/rubyspec/library/zlib/zstream/adler_spec.rb11
-rw-r--r--spec/rubyspec/library/zlib/zstream/avail_in_spec.rb9
-rw-r--r--spec/rubyspec/library/zlib/zstream/avail_out_spec.rb9
-rw-r--r--spec/rubyspec/library/zlib/zstream/close_spec.rb1
-rw-r--r--spec/rubyspec/library/zlib/zstream/closed_spec.rb1
-rw-r--r--spec/rubyspec/library/zlib/zstream/data_type_spec.rb9
-rw-r--r--spec/rubyspec/library/zlib/zstream/end_spec.rb1
-rw-r--r--spec/rubyspec/library/zlib/zstream/ended_spec.rb1
-rw-r--r--spec/rubyspec/library/zlib/zstream/finish_spec.rb1
-rw-r--r--spec/rubyspec/library/zlib/zstream/finished_spec.rb1
-rw-r--r--spec/rubyspec/library/zlib/zstream/flush_next_in_spec.rb1
-rw-r--r--spec/rubyspec/library/zlib/zstream/flush_next_out_spec.rb16
-rw-r--r--spec/rubyspec/library/zlib/zstream/reset_spec.rb1
-rw-r--r--spec/rubyspec/library/zlib/zstream/stream_end_spec.rb1
-rw-r--r--spec/rubyspec/library/zlib/zstream/total_in_spec.rb1
-rw-r--r--spec/rubyspec/library/zlib/zstream/total_out_spec.rb1
80 files changed, 0 insertions, 1682 deletions
diff --git a/spec/rubyspec/library/zlib/adler32_spec.rb b/spec/rubyspec/library/zlib/adler32_spec.rb
deleted file mode 100644
index 1767dc2011..0000000000
--- a/spec/rubyspec/library/zlib/adler32_spec.rb
+++ /dev/null
@@ -1,46 +0,0 @@
-require File.expand_path('../../../spec_helper', __FILE__)
-require 'zlib'
-
-describe "Zlib.adler32" do
- it "calculates Adler checksum for string" do
- Zlib.adler32("").should == 1
- Zlib.adler32(" ").should == 2162721
- Zlib.adler32("123456789").should == 152961502
- Zlib.adler32("!@#\{$\}%^&**()").should == 365495023
- Zlib.adler32("to be or not to be" * 22).should == 3979904837
- Zlib.adler32("0").should == 3211313
- Zlib.adler32((2**32).to_s).should == 193331739
- Zlib.adler32((2**64).to_s).should == 723452953
- end
-
- it "calculates Adler checksum for string and initial Adler value" do
- test_string = "This is a test string! How exciting!%?"
- Zlib.adler32(test_string, 0).should == 63900955
- Zlib.adler32(test_string, 1).should == 66391324
- Zlib.adler32(test_string, 2**8).should == 701435419
- Zlib.adler32(test_string, 2**16).should == 63966491
- lambda { Zlib.adler32(test_string, 2**128) }.should raise_error(RangeError)
- end
-
- it "calculates the Adler checksum for string and initial Adler value for Bignums" do
- test_string = "This is a test string! How exciting!%?"
- Zlib.adler32(test_string, 2**30).should == 1137642779
- end
-
- it "assumes that the initial value is given to adler, if adler is omitted" do
- orig_crc = Zlib.adler32
- Zlib.adler32("").should == Zlib.adler32("", orig_crc)
- Zlib.adler32(" ").should == Zlib.adler32(" ", orig_crc)
- Zlib.adler32("123456789").should == Zlib.adler32("123456789", orig_crc)
- Zlib.adler32("!@#\{$\}%^&**()").should == Zlib.adler32("!@#\{$\}%^&**()", orig_crc)
- Zlib.adler32("to be or not to be" * 22).should == Zlib.adler32("to be or not to be" * 22, orig_crc)
- Zlib.adler32("0").should == Zlib.adler32("0", orig_crc)
- Zlib.adler32((2**32).to_s).should == Zlib.adler32((2**32).to_s, orig_crc)
- Zlib.adler32((2**64).to_s).should == Zlib.adler32((2**64).to_s, orig_crc)
- end
-
- it "it returns the CRC initial value, if string is omitted" do
- Zlib.adler32.should == 1
- end
-
-end
diff --git a/spec/rubyspec/library/zlib/crc32_spec.rb b/spec/rubyspec/library/zlib/crc32_spec.rb
deleted file mode 100644
index 22d1dac28b..0000000000
--- a/spec/rubyspec/library/zlib/crc32_spec.rb
+++ /dev/null
@@ -1,52 +0,0 @@
-require File.expand_path('../../../spec_helper', __FILE__)
-require 'zlib'
-
-describe "Zlib.crc32" do
- it "calculates CRC checksum for string" do
- Zlib.crc32("").should == 0
- Zlib.crc32(" ").should == 3916222277
- Zlib.crc32("123456789").should == 3421780262
- Zlib.crc32("!@#\{$\}%^&**()").should == 2824518887
- Zlib.crc32("to be or not to be" * 22).should == 1832379978
- Zlib.crc32("0").should == 4108050209
- Zlib.crc32((2**32).to_s).should == 3267533297
- Zlib.crc32((2**64).to_s).should == 653721760
- end
-
- it "calculates CRC checksum for string and initial CRC value" do
- test_string = "This is a test string! How exciting!%?"
- # Zlib.crc32(test_string, -2**28).should == 3230195786
- # Zlib.crc32(test_string, -2**20).should == 2770207303
- # Zlib.crc32(test_string, -2**16).should == 2299432960
- # Zlib.crc32(test_string, -2**8).should == 861809849
- # Zlib.crc32(test_string, -1).should == 2170124077
- Zlib.crc32(test_string, 0).should == 3864990561
- Zlib.crc32(test_string, 1).should == 1809313411
- Zlib.crc32(test_string, 2**8).should == 1722745982
- Zlib.crc32(test_string, 2**16).should == 1932511220
- lambda { Zlib.crc32(test_string, 2**128) }.should raise_error(RangeError)
- end
-
- it "calculates the CRC checksum for string and initial CRC value for Bignums" do
- test_string = "This is a test string! How exciting!%?"
- # Zlib.crc32(test_string, -2**30).should == 277228695
- Zlib.crc32(test_string, 2**30).should == 46597132
- end
-
- it "assumes that the initial value is given to crc, if crc is omitted" do
- orig_crc = Zlib.crc32
- Zlib.crc32("").should == Zlib.crc32("", orig_crc)
- Zlib.crc32(" ").should == Zlib.crc32(" ", orig_crc)
- Zlib.crc32("123456789").should == Zlib.crc32("123456789", orig_crc)
- Zlib.crc32("!@#\{$\}%^&**()").should == Zlib.crc32("!@#\{$\}%^&**()", orig_crc)
- Zlib.crc32("to be or not to be" * 22).should == Zlib.crc32("to be or not to be" * 22, orig_crc)
- Zlib.crc32("0").should == Zlib.crc32("0", orig_crc)
- Zlib.crc32((2**32).to_s).should == Zlib.crc32((2**32).to_s, orig_crc)
- Zlib.crc32((2**64).to_s).should == Zlib.crc32((2**64).to_s, orig_crc)
- end
-
- it "it returns the CRC initial value, if string is omitted" do
- Zlib.crc32.should == 0
- end
-
-end
diff --git a/spec/rubyspec/library/zlib/crc_table_spec.rb b/spec/rubyspec/library/zlib/crc_table_spec.rb
deleted file mode 100644
index 22aaa32233..0000000000
--- a/spec/rubyspec/library/zlib/crc_table_spec.rb
+++ /dev/null
@@ -1,75 +0,0 @@
-require File.expand_path('../../../spec_helper', __FILE__)
-require "zlib"
-
-describe "Zlib.crc_table" do
-
- it "returns the same value as zlib's get_crc_table()" do
- Zlib.crc_table.should == [
- 0, 1996959894, 3993919788, 2567524794,
- 124634137, 1886057615, 3915621685, 2657392035,
- 249268274, 2044508324, 3772115230, 2547177864,
- 162941995, 2125561021, 3887607047, 2428444049,
- 498536548, 1789927666, 4089016648, 2227061214,
- 450548861, 1843258603, 4107580753, 2211677639,
- 325883990, 1684777152, 4251122042, 2321926636,
- 335633487, 1661365465, 4195302755, 2366115317,
- 997073096, 1281953886, 3579855332, 2724688242,
- 1006888145, 1258607687, 3524101629, 2768942443,
- 901097722, 1119000684, 3686517206, 2898065728,
- 853044451, 1172266101, 3705015759, 2882616665,
- 651767980, 1373503546, 3369554304, 3218104598,
- 565507253, 1454621731, 3485111705, 3099436303,
- 671266974, 1594198024, 3322730930, 2970347812,
- 795835527, 1483230225, 3244367275, 3060149565,
- 1994146192, 31158534, 2563907772, 4023717930,
- 1907459465, 112637215, 2680153253, 3904427059,
- 2013776290, 251722036, 2517215374, 3775830040,
- 2137656763, 141376813, 2439277719, 3865271297,
- 1802195444, 476864866, 2238001368, 4066508878,
- 1812370925, 453092731, 2181625025, 4111451223,
- 1706088902, 314042704, 2344532202, 4240017532,
- 1658658271, 366619977, 2362670323, 4224994405,
- 1303535960, 984961486, 2747007092, 3569037538,
- 1256170817, 1037604311, 2765210733, 3554079995,
- 1131014506, 879679996, 2909243462, 3663771856,
- 1141124467, 855842277, 2852801631, 3708648649,
- 1342533948, 654459306, 3188396048, 3373015174,
- 1466479909, 544179635, 3110523913, 3462522015,
- 1591671054, 702138776, 2966460450, 3352799412,
- 1504918807, 783551873, 3082640443, 3233442989,
- 3988292384, 2596254646, 62317068, 1957810842,
- 3939845945, 2647816111, 81470997, 1943803523,
- 3814918930, 2489596804, 225274430, 2053790376,
- 3826175755, 2466906013, 167816743, 2097651377,
- 4027552580, 2265490386, 503444072, 1762050814,
- 4150417245, 2154129355, 426522225, 1852507879,
- 4275313526, 2312317920, 282753626, 1742555852,
- 4189708143, 2394877945, 397917763, 1622183637,
- 3604390888, 2714866558, 953729732, 1340076626,
- 3518719985, 2797360999, 1068828381, 1219638859,
- 3624741850, 2936675148, 906185462, 1090812512,
- 3747672003, 2825379669, 829329135, 1181335161,
- 3412177804, 3160834842, 628085408, 1382605366,
- 3423369109, 3138078467, 570562233, 1426400815,
- 3317316542, 2998733608, 733239954, 1555261956,
- 3268935591, 3050360625, 752459403, 1541320221,
- 2607071920, 3965973030, 1969922972, 40735498,
- 2617837225, 3943577151, 1913087877, 83908371,
- 2512341634, 3803740692, 2075208622, 213261112,
- 2463272603, 3855990285, 2094854071, 198958881,
- 2262029012, 4057260610, 1759359992, 534414190,
- 2176718541, 4139329115, 1873836001, 414664567,
- 2282248934, 4279200368, 1711684554, 285281116,
- 2405801727, 4167216745, 1634467795, 376229701,
- 2685067896, 3608007406, 1308918612, 956543938,
- 2808555105, 3495958263, 1231636301, 1047427035,
- 2932959818, 3654703836, 1088359270, 936918000,
- 2847714899, 3736837829, 1202900863, 817233897,
- 3183342108, 3401237130, 1404277552, 615818150,
- 3134207493, 3453421203, 1423857449, 601450431,
- 3009837614, 3294710456, 1567103746, 711928724,
- 3020668471, 3272380065, 1510334235, 755167117,
- ]
- end
-
-end
diff --git a/spec/rubyspec/library/zlib/deflate/append_spec.rb b/spec/rubyspec/library/zlib/deflate/append_spec.rb
deleted file mode 100644
index 6a4c1dadb4..0000000000
--- a/spec/rubyspec/library/zlib/deflate/append_spec.rb
+++ /dev/null
@@ -1 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
diff --git a/spec/rubyspec/library/zlib/deflate/deflate_spec.rb b/spec/rubyspec/library/zlib/deflate/deflate_spec.rb
deleted file mode 100644
index 44b3389701..0000000000
--- a/spec/rubyspec/library/zlib/deflate/deflate_spec.rb
+++ /dev/null
@@ -1,128 +0,0 @@
-require 'zlib'
-require File.expand_path('../../../../spec_helper', __FILE__)
-
-describe "Zlib::Deflate.deflate" do
- it "deflates some data" do
- data = Array.new(10,0).pack('C*')
-
- zipped = Zlib::Deflate.deflate data
-
- zipped.should == [120, 156, 99, 96, 128, 1, 0, 0, 10, 0, 1].pack('C*')
- end
-
- it "deflates lots of data" do
- data = "\000" * 32 * 1024
-
- zipped = Zlib::Deflate.deflate data
-
- zipped.should == ([120, 156, 237, 193, 1, 1, 0, 0] +
- [0, 128, 144, 254, 175, 238, 8, 10] +
- Array.new(31, 0) +
- [24, 128, 0, 0, 1]).pack('C*')
- end
-
- it "deflates chunked data" do
- random_generator = Random.new(0)
- deflated = ''
-
- Zlib.deflate(random_generator.bytes(20000)) do |chunk|
- deflated << chunk
- end
-
- deflated.length.should == 20016
- end
-end
-
-describe "Zlib::Deflate#deflate" do
- before :each do
- @deflator = Zlib::Deflate.new
- end
-
- it "deflates some data" do
- data = "\000" * 10
-
- zipped = @deflator.deflate data, Zlib::FINISH
- @deflator.finish
-
- zipped.should == [120, 156, 99, 96, 128, 1, 0, 0, 10, 0, 1].pack('C*')
- end
-
- it "deflates lots of data" do
- data = "\000" * 32 * 1024
-
- zipped = @deflator.deflate data, Zlib::FINISH
- @deflator.finish
-
- zipped.should == ([120, 156, 237, 193, 1, 1, 0, 0] +
- [0, 128, 144, 254, 175, 238, 8, 10] +
- Array.new(31, 0) +
- [24, 128, 0, 0, 1]).pack('C*')
- end
-end
-
-describe "Zlib::Deflate#deflate" do
-
- before :each do
- @deflator = Zlib::Deflate.new
- @random_generator = Random.new(0)
- @original = ''
- @chunks = []
- end
-
- describe "without break" do
-
- before do
- 2.times do
- @input = @random_generator.bytes(20000)
- @original << @input
- @deflator.deflate(@input) do |chunk|
- @chunks << chunk
- end
- end
- end
-
- it "deflates chunked data" do
- @deflator.finish
- @chunks.map { |chunk| chunk.length }.should == [16384, 16384]
- end
-
- it "deflates chunked data with final chunk" do
- final = @deflator.finish
- final.length.should == 7253
- end
-
- it "deflates chunked data without errors" do
- final = @deflator.finish
- @chunks << final
- @original.should == Zlib.inflate(@chunks.join)
- end
-
- end
-
- describe "with break" do
- before :each do
- @input = @random_generator.bytes(20000)
- @deflator.deflate(@input) do |chunk|
- @chunks << chunk
- break
- end
- end
-
- it "deflates only first chunk" do
- @deflator.finish
- @chunks.map { |chunk| chunk.length }.should == [16384]
- end
-
- it "deflates chunked data with final chunk" do
- final = @deflator.finish
- final.length.should == 3632
- end
-
- it "deflates chunked data without errors" do
- final = @deflator.finish
- @chunks << final
- @input.should == Zlib.inflate(@chunks.join)
- end
-
- end
-end
diff --git a/spec/rubyspec/library/zlib/deflate/flush_spec.rb b/spec/rubyspec/library/zlib/deflate/flush_spec.rb
deleted file mode 100644
index 6a4c1dadb4..0000000000
--- a/spec/rubyspec/library/zlib/deflate/flush_spec.rb
+++ /dev/null
@@ -1 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
diff --git a/spec/rubyspec/library/zlib/deflate/new_spec.rb b/spec/rubyspec/library/zlib/deflate/new_spec.rb
deleted file mode 100644
index 6a4c1dadb4..0000000000
--- a/spec/rubyspec/library/zlib/deflate/new_spec.rb
+++ /dev/null
@@ -1 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
diff --git a/spec/rubyspec/library/zlib/deflate/params_spec.rb b/spec/rubyspec/library/zlib/deflate/params_spec.rb
deleted file mode 100644
index 59b1353c07..0000000000
--- a/spec/rubyspec/library/zlib/deflate/params_spec.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require 'zlib'
-
-describe "Zlib::Deflate#params" do
- it "changes the deflate parameters" do
- data = 'abcdefghijklm'
-
- d = Zlib::Deflate.new Zlib::NO_COMPRESSION, Zlib::MAX_WBITS,
- Zlib::DEF_MEM_LEVEL, Zlib::DEFAULT_STRATEGY
-
- d << data.slice!(0..10)
- d.params Zlib::BEST_COMPRESSION, Zlib::DEFAULT_STRATEGY
- d << data
-
- Zlib::Inflate.inflate(d.finish).should == 'abcdefghijklm'
- end
-end
diff --git a/spec/rubyspec/library/zlib/deflate/set_dictionary_spec.rb b/spec/rubyspec/library/zlib/deflate/set_dictionary_spec.rb
deleted file mode 100644
index c5c62d9529..0000000000
--- a/spec/rubyspec/library/zlib/deflate/set_dictionary_spec.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require 'zlib'
-
-describe "Zlib::Deflate#set_dictionary" do
- it "sets the dictionary" do
- d = Zlib::Deflate.new
- d.set_dictionary 'aaaaaaaaaa'
- d << 'abcdefghij'
-
- d.finish.should == [120, 187, 20, 225, 3, 203, 75, 76,
- 74, 78, 73, 77, 75, 207, 200, 204,
- 2, 0, 21, 134, 3, 248].pack('C*')
- end
-end
-
diff --git a/spec/rubyspec/library/zlib/gzipfile/close_spec.rb b/spec/rubyspec/library/zlib/gzipfile/close_spec.rb
deleted file mode 100644
index 9486d6b9ec..0000000000
--- a/spec/rubyspec/library/zlib/gzipfile/close_spec.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require 'stringio'
-require 'zlib'
-
-describe "Zlib::GzipFile#close" do
- it "finishes the stream and closes the io" do
- io = StringIO.new "".b
- Zlib::GzipWriter.wrap io do |gzio|
- gzio.close
-
- gzio.closed?.should == true
-
- lambda { gzio.orig_name }.should \
- raise_error(Zlib::GzipFile::Error, 'closed gzip stream')
- lambda { gzio.comment }.should \
- raise_error(Zlib::GzipFile::Error, 'closed gzip stream')
- end
-
- io.string[10..-1].should == ([3] + Array.new(9,0)).pack('C*')
- end
-end
-
diff --git a/spec/rubyspec/library/zlib/gzipfile/closed_spec.rb b/spec/rubyspec/library/zlib/gzipfile/closed_spec.rb
deleted file mode 100644
index 69785bc41c..0000000000
--- a/spec/rubyspec/library/zlib/gzipfile/closed_spec.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require 'stringio'
-require 'zlib'
-
-describe "Zlib::GzipFile#closed?" do
- it "returns the closed status" do
- io = StringIO.new
- Zlib::GzipWriter.wrap io do |gzio|
- gzio.closed?.should == false
-
- gzio.close
-
- gzio.closed?.should == true
- end
- end
-end
-
diff --git a/spec/rubyspec/library/zlib/gzipfile/comment_spec.rb b/spec/rubyspec/library/zlib/gzipfile/comment_spec.rb
deleted file mode 100644
index 638e85a4a7..0000000000
--- a/spec/rubyspec/library/zlib/gzipfile/comment_spec.rb
+++ /dev/null
@@ -1,27 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require 'stringio'
-require 'zlib'
-
-describe "Zlib::GzipFile#comment" do
- before :each do
- @io = StringIO.new
- end
-
- it "returns the name" do
- Zlib::GzipWriter.wrap @io do |gzio|
- gzio.comment = 'name'
-
- gzio.comment.should == 'name'
- end
- end
-
- it "raises an error on a closed stream" do
- Zlib::GzipWriter.wrap @io do |gzio|
- gzio.close
-
- lambda { gzio.comment }.should \
- raise_error(Zlib::GzipFile::Error, 'closed gzip stream')
- end
- end
-end
-
diff --git a/spec/rubyspec/library/zlib/gzipfile/crc_spec.rb b/spec/rubyspec/library/zlib/gzipfile/crc_spec.rb
deleted file mode 100644
index 6a4c1dadb4..0000000000
--- a/spec/rubyspec/library/zlib/gzipfile/crc_spec.rb
+++ /dev/null
@@ -1 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
diff --git a/spec/rubyspec/library/zlib/gzipfile/finish_spec.rb b/spec/rubyspec/library/zlib/gzipfile/finish_spec.rb
deleted file mode 100644
index 6a4c1dadb4..0000000000
--- a/spec/rubyspec/library/zlib/gzipfile/finish_spec.rb
+++ /dev/null
@@ -1 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
diff --git a/spec/rubyspec/library/zlib/gzipfile/level_spec.rb b/spec/rubyspec/library/zlib/gzipfile/level_spec.rb
deleted file mode 100644
index 6a4c1dadb4..0000000000
--- a/spec/rubyspec/library/zlib/gzipfile/level_spec.rb
+++ /dev/null
@@ -1 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
diff --git a/spec/rubyspec/library/zlib/gzipfile/mtime_spec.rb b/spec/rubyspec/library/zlib/gzipfile/mtime_spec.rb
deleted file mode 100644
index 6a4c1dadb4..0000000000
--- a/spec/rubyspec/library/zlib/gzipfile/mtime_spec.rb
+++ /dev/null
@@ -1 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
diff --git a/spec/rubyspec/library/zlib/gzipfile/orig_name_spec.rb b/spec/rubyspec/library/zlib/gzipfile/orig_name_spec.rb
deleted file mode 100644
index 42a3b2f376..0000000000
--- a/spec/rubyspec/library/zlib/gzipfile/orig_name_spec.rb
+++ /dev/null
@@ -1,27 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require 'stringio'
-require 'zlib'
-
-describe "Zlib::GzipFile#orig_name" do
- before :each do
- @io = StringIO.new
- end
-
- it "returns the name" do
- Zlib::GzipWriter.wrap @io do |gzio|
- gzio.orig_name = 'name'
-
- gzio.orig_name.should == 'name'
- end
- end
-
- it "raises an error on a closed stream" do
- Zlib::GzipWriter.wrap @io do |gzio|
- gzio.close
-
- lambda { gzio.orig_name }.should \
- raise_error(Zlib::GzipFile::Error, 'closed gzip stream')
- end
- end
-end
-
diff --git a/spec/rubyspec/library/zlib/gzipfile/os_code_spec.rb b/spec/rubyspec/library/zlib/gzipfile/os_code_spec.rb
deleted file mode 100644
index 6a4c1dadb4..0000000000
--- a/spec/rubyspec/library/zlib/gzipfile/os_code_spec.rb
+++ /dev/null
@@ -1 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
diff --git a/spec/rubyspec/library/zlib/gzipfile/sync_spec.rb b/spec/rubyspec/library/zlib/gzipfile/sync_spec.rb
deleted file mode 100644
index 6a4c1dadb4..0000000000
--- a/spec/rubyspec/library/zlib/gzipfile/sync_spec.rb
+++ /dev/null
@@ -1 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
diff --git a/spec/rubyspec/library/zlib/gzipfile/to_io_spec.rb b/spec/rubyspec/library/zlib/gzipfile/to_io_spec.rb
deleted file mode 100644
index 6a4c1dadb4..0000000000
--- a/spec/rubyspec/library/zlib/gzipfile/to_io_spec.rb
+++ /dev/null
@@ -1 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
diff --git a/spec/rubyspec/library/zlib/gzipfile/wrap_spec.rb b/spec/rubyspec/library/zlib/gzipfile/wrap_spec.rb
deleted file mode 100644
index 6a4c1dadb4..0000000000
--- a/spec/rubyspec/library/zlib/gzipfile/wrap_spec.rb
+++ /dev/null
@@ -1 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
diff --git a/spec/rubyspec/library/zlib/gzipreader/each_byte_spec.rb b/spec/rubyspec/library/zlib/gzipreader/each_byte_spec.rb
deleted file mode 100644
index 6da9ac8323..0000000000
--- a/spec/rubyspec/library/zlib/gzipreader/each_byte_spec.rb
+++ /dev/null
@@ -1,51 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require 'stringio'
-require 'zlib'
-
-describe "GzipReader#each_byte" do
-
- before :each do
- @data = '12345abcde'
- @zip = [31, 139, 8, 0, 44, 220, 209, 71, 0, 3, 51, 52, 50, 54, 49, 77,
- 76, 74, 78, 73, 5, 0, 157, 5, 0, 36, 10, 0, 0, 0].pack('C*')
-
- @io = StringIO.new @zip
- ScratchPad.clear
- end
-
- it "calls the given block for each byte in the stream, passing the byte as an argument" do
- gz = Zlib::GzipReader.new @io
-
- ScratchPad.record []
- gz.each_byte { |b| ScratchPad << b }
-
- ScratchPad.recorded.should == [49, 50, 51, 52, 53, 97, 98, 99, 100, 101]
- end
-
- it "returns an enumerator, which yields each byte in the stream, when no block is passed" do
- gz = Zlib::GzipReader.new @io
- enum = gz.each_byte
-
- ScratchPad.record []
- while true
- begin
- ScratchPad << enum.next
- rescue StopIteration
- break
- end
- end
-
- ScratchPad.recorded.should == [49, 50, 51, 52, 53, 97, 98, 99, 100, 101]
- end
-
- it "increments position before calling the block" do
- gz = Zlib::GzipReader.new @io
-
- i = 1
- gz.each_byte do |ignore|
- gz.pos.should == i
- i += 1
- end
- end
-
-end
diff --git a/spec/rubyspec/library/zlib/gzipreader/each_line_spec.rb b/spec/rubyspec/library/zlib/gzipreader/each_line_spec.rb
deleted file mode 100644
index 7ff116a258..0000000000
--- a/spec/rubyspec/library/zlib/gzipreader/each_line_spec.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-require File.expand_path('../shared/each', __FILE__)
-
-describe "GzipReader#each_line" do
- it_behaves_like :gzipreader_each, :each_line
-end
diff --git a/spec/rubyspec/library/zlib/gzipreader/each_spec.rb b/spec/rubyspec/library/zlib/gzipreader/each_spec.rb
deleted file mode 100644
index dd780e4083..0000000000
--- a/spec/rubyspec/library/zlib/gzipreader/each_spec.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-require File.expand_path('../shared/each', __FILE__)
-
-describe "GzipReader#each" do
- it_behaves_like :gzipreader_each, :each
-end
diff --git a/spec/rubyspec/library/zlib/gzipreader/eof_spec.rb b/spec/rubyspec/library/zlib/gzipreader/eof_spec.rb
deleted file mode 100644
index 446cbfec37..0000000000
--- a/spec/rubyspec/library/zlib/gzipreader/eof_spec.rb
+++ /dev/null
@@ -1,56 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require 'stringio'
-require 'zlib'
-
-describe "GzipReader#eof?" do
-
- before :each do
- @data = '{"a":1234}'
- @zip = [31, 139, 8, 0, 0, 0, 0, 0, 0, 3, 171, 86, 74, 84, 178, 50,
- 52, 50, 54, 169, 5, 0, 196, 20, 118, 213, 10, 0, 0, 0].pack('C*')
- @io = StringIO.new @zip
- end
-
- it "returns true when at EOF" do
- gz = Zlib::GzipReader.new @io
- gz.eof?.should be_false
- gz.read
- gz.eof?.should be_true
- end
-
- it "returns true when at EOF with the exact length of uncompressed data" do
- gz = Zlib::GzipReader.new @io
- gz.eof?.should be_false
- gz.read(10)
- gz.eof?.should be_true
- end
-
- it "returns true when at EOF with a length greater than the size of uncompressed data" do
- gz = Zlib::GzipReader.new @io
- gz.eof?.should be_false
- gz.read(11)
- gz.eof?.should be_true
- end
-
- it "returns false when at EOF when there's data left in the buffer to read" do
- gz = Zlib::GzipReader.new @io
- gz.read(9)
- gz.eof?.should be_false
- gz.read
- gz.eof?.should be_true
- end
-
- # This is especially important for JRuby, since eof? there
- # is more than just a simple accessor.
- it "does not affect the reading data" do
- gz = Zlib::GzipReader.new @io
- 0.upto(9) do |i|
- gz.eof?.should be_false
- gz.read(1).should == @data[i, 1]
- end
- gz.eof?.should be_true
- gz.read().should == ""
- gz.eof?.should be_true
- end
-
-end
diff --git a/spec/rubyspec/library/zlib/gzipreader/getc_spec.rb b/spec/rubyspec/library/zlib/gzipreader/getc_spec.rb
deleted file mode 100644
index a3c4aecf76..0000000000
--- a/spec/rubyspec/library/zlib/gzipreader/getc_spec.rb
+++ /dev/null
@@ -1,41 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require 'stringio'
-require 'zlib'
-
-describe "GzipReader#getc" do
-
- before :each do
- @data = '12345abcde'
- @zip = [31, 139, 8, 0, 44, 220, 209, 71, 0, 3, 51, 52, 50, 54, 49, 77,
- 76, 74, 78, 73, 5, 0, 157, 5, 0, 36, 10, 0, 0, 0].pack('C*')
- @io = StringIO.new @zip
- end
-
- it "returns the next character from the stream" do
- gz = Zlib::GzipReader.new @io
- gz.pos.should == 0
-
- gz.getc.should == '1'
- gz.getc.should == '2'
- gz.getc.should == '3'
- gz.getc.should == '4'
- gz.getc.should == '5'
- end
-
- it "increments position" do
- gz = Zlib::GzipReader.new @io
- ([email protected]).each do |i|
- gz.pos.should == i
- gz.getc
- end
- end
-
- it "returns nil at the end of the stream" do
- gz = Zlib::GzipReader.new @io
- gz.read
- pos = gz.pos
- gz.getc.should be_nil
- gz.pos.should == pos
- end
-
-end
diff --git a/spec/rubyspec/library/zlib/gzipreader/gets_spec.rb b/spec/rubyspec/library/zlib/gzipreader/gets_spec.rb
deleted file mode 100644
index d49adc2850..0000000000
--- a/spec/rubyspec/library/zlib/gzipreader/gets_spec.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require 'zlib'
-require 'stringio'
-
-describe 'GzipReader#gets' do
- describe 'with "" separator' do
- it 'reads paragraphs skipping newlines' do
- # gz contains "\n\n\n\n\n123\n45\n\n\n\n\nabc\nde\n\n\n\n\n"
- gz = Zlib::GzipReader.new(
- StringIO.new(
- [31, 139, 8, 0, 223, 152, 48, 89, 0, 3, 227, 226, 2, 2, 67, 35,
- 99, 46, 19, 83, 16, 139, 43, 49, 41, 153, 43, 37, 21, 204, 4, 0,
- 32, 119, 45, 184, 27, 0, 0, 0].pack('C*')
- )
- )
-
- gz.gets('').should == "123\n45\n\n"
- gz.gets('').should == "abc\nde\n\n"
- gz.eof?.should be_true
- end
- end
-end
diff --git a/spec/rubyspec/library/zlib/gzipreader/lineno_spec.rb b/spec/rubyspec/library/zlib/gzipreader/lineno_spec.rb
deleted file mode 100644
index 6a4c1dadb4..0000000000
--- a/spec/rubyspec/library/zlib/gzipreader/lineno_spec.rb
+++ /dev/null
@@ -1 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
diff --git a/spec/rubyspec/library/zlib/gzipreader/new_spec.rb b/spec/rubyspec/library/zlib/gzipreader/new_spec.rb
deleted file mode 100644
index 6a4c1dadb4..0000000000
--- a/spec/rubyspec/library/zlib/gzipreader/new_spec.rb
+++ /dev/null
@@ -1 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
diff --git a/spec/rubyspec/library/zlib/gzipreader/open_spec.rb b/spec/rubyspec/library/zlib/gzipreader/open_spec.rb
deleted file mode 100644
index 6a4c1dadb4..0000000000
--- a/spec/rubyspec/library/zlib/gzipreader/open_spec.rb
+++ /dev/null
@@ -1 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
diff --git a/spec/rubyspec/library/zlib/gzipreader/pos_spec.rb b/spec/rubyspec/library/zlib/gzipreader/pos_spec.rb
deleted file mode 100644
index 66fbf388d8..0000000000
--- a/spec/rubyspec/library/zlib/gzipreader/pos_spec.rb
+++ /dev/null
@@ -1,27 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require 'stringio'
-require 'zlib'
-
-describe "GzipReader#pos" do
-
- before :each do
- @data = '12345abcde'
- @zip = [31, 139, 8, 0, 44, 220, 209, 71, 0, 3, 51, 52, 50, 54, 49, 77,
- 76, 74, 78, 73, 5, 0, 157, 5, 0, 36, 10, 0, 0, 0].pack('C*')
- @io = StringIO.new @zip
- end
-
- it "returns the position" do
- gz = Zlib::GzipReader.new @io
-
- gz.pos.should == 0
-
- gz.read 5
- gz.pos.should == 5
-
- gz.read
- gz.pos.should == @data.length
- end
-
-end
-
diff --git a/spec/rubyspec/library/zlib/gzipreader/read_spec.rb b/spec/rubyspec/library/zlib/gzipreader/read_spec.rb
deleted file mode 100644
index 337f507502..0000000000
--- a/spec/rubyspec/library/zlib/gzipreader/read_spec.rb
+++ /dev/null
@@ -1,68 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require 'stringio'
-require 'zlib'
-
-describe "GzipReader#read" do
-
- before :each do
- @data = '12345abcde'
- @zip = [31, 139, 8, 0, 44, 220, 209, 71, 0, 3, 51, 52, 50, 54, 49, 77,
- 76, 74, 78, 73, 5, 0, 157, 5, 0, 36, 10, 0, 0, 0].pack('C*')
- @io = StringIO.new @zip
- end
-
- it "with no arguments reads the entire content of a gzip file" do
- gz = Zlib::GzipReader.new @io
- gz.read.should == @data
- end
-
- it "with nil length argument reads the entire content of a gzip file" do
- gz = Zlib::GzipReader.new @io
- gz.read(nil).should == @data
- end
-
- it "reads the contents up to a certain size" do
- gz = Zlib::GzipReader.new @io
- gz.read(5).should == @data[0...5]
- gz.read(5).should == @data[5...10]
- end
-
- it "does not accept a negative length to read" do
- gz = Zlib::GzipReader.new @io
- lambda {
- gz.read(-1)
- }.should raise_error(ArgumentError)
- end
-
- it "returns an empty string if a 0 length is given" do
- gz = Zlib::GzipReader.new @io
- gz.read(0).should == ""
- end
-
- it "respects :external_encoding option" do
- gz = Zlib::GzipReader.new(@io, external_encoding: 'UTF-8')
- gz.read.encoding.should == Encoding::UTF_8
-
- @io.rewind
- gz = Zlib::GzipReader.new(@io, external_encoding: 'UTF-16LE')
- gz.read.encoding.should == Encoding::UTF_16LE
- end
-
- describe "at the end of data" do
- it "returns empty string if length prameter is not specified or 0" do
- gz = Zlib::GzipReader.new @io
- gz.read # read till the end
- gz.read(0).should == ""
- gz.read().should == ""
- gz.read(nil).should == ""
- end
-
- it "returns nil if length prameter is positive" do
- gz = Zlib::GzipReader.new @io
- gz.read # read till the end
- gz.read(1).should be_nil
- gz.read(2**16).should be_nil
- end
- end
-
-end
diff --git a/spec/rubyspec/library/zlib/gzipreader/readchar_spec.rb b/spec/rubyspec/library/zlib/gzipreader/readchar_spec.rb
deleted file mode 100644
index 6a4c1dadb4..0000000000
--- a/spec/rubyspec/library/zlib/gzipreader/readchar_spec.rb
+++ /dev/null
@@ -1 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
diff --git a/spec/rubyspec/library/zlib/gzipreader/readline_spec.rb b/spec/rubyspec/library/zlib/gzipreader/readline_spec.rb
deleted file mode 100644
index 6a4c1dadb4..0000000000
--- a/spec/rubyspec/library/zlib/gzipreader/readline_spec.rb
+++ /dev/null
@@ -1 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
diff --git a/spec/rubyspec/library/zlib/gzipreader/readlines_spec.rb b/spec/rubyspec/library/zlib/gzipreader/readlines_spec.rb
deleted file mode 100644
index 6a4c1dadb4..0000000000
--- a/spec/rubyspec/library/zlib/gzipreader/readlines_spec.rb
+++ /dev/null
@@ -1 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
diff --git a/spec/rubyspec/library/zlib/gzipreader/readpartial_spec.rb b/spec/rubyspec/library/zlib/gzipreader/readpartial_spec.rb
deleted file mode 100644
index 2cdef54fd1..0000000000
--- a/spec/rubyspec/library/zlib/gzipreader/readpartial_spec.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require 'stringio'
-require 'zlib'
-
-describe 'GzipReader#readpartial' do
- before :each do
- @data = '12345abcde'
- @zip = [31, 139, 8, 0, 44, 220, 209, 71, 0, 3, 51, 52, 50, 54, 49, 77,
- 76, 74, 78, 73, 5, 0, 157, 5, 0, 36, 10, 0, 0, 0].pack('C*')
- @io = StringIO.new(@zip)
- end
-
- it 'accepts nil buffer' do
- gz = Zlib::GzipReader.new(@io)
- gz.readpartial(5, nil).should == '12345'
- end
-end
diff --git a/spec/rubyspec/library/zlib/gzipreader/rewind_spec.rb b/spec/rubyspec/library/zlib/gzipreader/rewind_spec.rb
deleted file mode 100644
index 70bee3372d..0000000000
--- a/spec/rubyspec/library/zlib/gzipreader/rewind_spec.rb
+++ /dev/null
@@ -1,48 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require 'stringio'
-require 'zlib'
-
-describe "GzipReader#rewind" do
-
- before :each do
- @data = '12345abcde'
- @zip = [31, 139, 8, 0, 44, 220, 209, 71, 0, 3, 51, 52, 50, 54, 49, 77,
- 76, 74, 78, 73, 5, 0, 157, 5, 0, 36, 10, 0, 0, 0].pack('C*')
- @io = StringIO.new @zip
- ScratchPad.clear
- end
-
- it "resets the position of the stream pointer" do
- gz = Zlib::GzipReader.new @io
- gz.read
- gz.pos.should == @data.length
-
- gz.rewind
- gz.pos.should == 0
- gz.lineno.should == 0
- end
-
- it "resets the position of the stream pointer to data previously read" do
- gz = Zlib::GzipReader.new @io
- first_read = gz.read
- gz.rewind
- first_read.should == gz.read
- end
-
- it "invokes seek method on the associated IO object" do
- # first, prepare the mock object:
- (obj = mock("io")).should_receive(:get_io).any_number_of_times.and_return(@io)
- def obj.read(args); get_io.read(args); end
- def obj.seek(pos, whence = 0)
- ScratchPad.record :seek
- get_io.seek(pos, whence)
- end
-
- gz = Zlib::GzipReader.new(obj)
- gz.rewind()
-
- ScratchPad.recorded.should == :seek
- gz.pos.should == 0
- gz.read.should == "12345abcde"
- end
-end
diff --git a/spec/rubyspec/library/zlib/gzipreader/shared/each.rb b/spec/rubyspec/library/zlib/gzipreader/shared/each.rb
deleted file mode 100644
index 47cd284b6a..0000000000
--- a/spec/rubyspec/library/zlib/gzipreader/shared/each.rb
+++ /dev/null
@@ -1,51 +0,0 @@
-require File.expand_path('../../../../../spec_helper', __FILE__)
-require 'stringio'
-require 'zlib'
-
-describe :gzipreader_each, shared: true do
-
- before :each do
- @data = "firstline\nsecondline\n\nforthline"
- @zip = [31, 139, 8, 0, 244, 125, 128, 88, 2, 255, 75, 203, 44, 42, 46, 201,
- 201, 204, 75, 229, 42, 78, 77, 206, 207, 75, 1, 51, 185, 210,242,
- 139, 74, 50, 64, 76, 0, 180, 54, 61, 111, 31, 0, 0, 0].pack('C*')
-
- @io = StringIO.new @zip
- @gzreader = Zlib::GzipReader.new @io
- end
-
- after :each do
- ScratchPad.clear
- end
-
- it "calls the given block for each line in the stream, passing the line as an argument" do
- ScratchPad.record []
- @gzreader.send(@method) { |b| ScratchPad << b }
-
- ScratchPad.recorded.should == ["firstline\n", "secondline\n", "\n", "forthline"]
- end
-
- it "returns an enumerator, which yields each byte in the stream, when no block is passed" do
- enum = @gzreader.send(@method)
-
- ScratchPad.record []
- while true
- begin
- ScratchPad << enum.next
- rescue StopIteration
- break
- end
- end
-
- ScratchPad.recorded.should == ["firstline\n", "secondline\n", "\n", "forthline"]
- end
-
- it "increments position before calling the block" do
- i = 0
- @gzreader.send(@method) do |line|
- i += line.length
- @gzreader.pos.should == i
- end
- end
-
-end
diff --git a/spec/rubyspec/library/zlib/gzipreader/tell_spec.rb b/spec/rubyspec/library/zlib/gzipreader/tell_spec.rb
deleted file mode 100644
index 6a4c1dadb4..0000000000
--- a/spec/rubyspec/library/zlib/gzipreader/tell_spec.rb
+++ /dev/null
@@ -1 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
diff --git a/spec/rubyspec/library/zlib/gzipreader/ungetbyte_spec.rb b/spec/rubyspec/library/zlib/gzipreader/ungetbyte_spec.rb
deleted file mode 100644
index 16f1c12272..0000000000
--- a/spec/rubyspec/library/zlib/gzipreader/ungetbyte_spec.rb
+++ /dev/null
@@ -1,122 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require 'stringio'
-require 'zlib'
-
-describe 'GzipReader#ungetbyte' do
- before :each do
- @data = '12345abcde'
- @zip = [31, 139, 8, 0, 44, 220, 209, 71, 0, 3, 51, 52, 50, 54, 49, 77,
- 76, 74, 78, 73, 5, 0, 157, 5, 0, 36, 10, 0, 0, 0].pack('C*')
- @io = StringIO.new @zip
- end
-
- describe 'at the start of the stream' do
- before :each do
- @gz = Zlib::GzipReader.new(@io)
- end
-
- describe 'with an integer' do
- it 'prepends the byte to the stream' do
- @gz.ungetbyte 0x21
- @gz.read.should == '!12345abcde'
- end
-
- ruby_bug "#13616", ""..."2.6" do
- it 'decrements pos' do
- @gz.ungetbyte 0x21
- @gz.pos.should == -1
- end
- end
- end
-
- quarantine! do # https://bugs.ruby-lang.org/issues/13675
- describe 'with nil' do
- it 'does not prepend anything to the stream' do
- @gz.ungetbyte nil
- @gz.read.should == '12345abcde'
- end
-
- it 'does not decrement pos' do
- @gz.ungetbyte nil
- @gz.pos.should == 0
- end
- end
- end
- end
-
- describe 'in the middle of the stream' do
- before :each do
- @gz = Zlib::GzipReader.new(@io)
- @gz.read 5
- end
-
- describe 'with an integer' do
- it 'inserts the corresponding character into the stream' do
- @gz.ungetbyte 0x21
- @gz.read.should == '!abcde'
- end
-
- it 'decrements pos' do
- @gz.ungetbyte 0x21
- @gz.pos.should == 4
- end
- end
-
- quarantine! do # https://bugs.ruby-lang.org/issues/13675
- describe 'with nil' do
- it 'does not insert anything into the stream' do
- @gz.ungetbyte nil
- @gz.read.should == 'abcde'
- end
-
- it 'does not decrement pos' do
- @gz.ungetbyte nil
- @gz.pos.should == 5
- end
- end
- end
- end
-
- describe 'at the end of the stream' do
- before :each do
- @gz = Zlib::GzipReader.new(@io)
- @gz.read
- end
-
- describe 'with an integer' do
- it 'appends the corresponding character to the stream' do
- @gz.ungetbyte 0x21
- @gz.read.should == '!'
- end
-
- it 'decrements pos' do
- @gz.ungetbyte 0x21
- @gz.pos.should == 9
- end
-
- it 'makes eof? false' do
- @gz.ungetbyte 0x21
- @gz.eof?.should be_false
- end
- end
-
- quarantine! do # https://bugs.ruby-lang.org/issues/13675
- describe 'with nil' do
- it 'does not append anything to the stream' do
- @gz.ungetbyte nil
- @gz.read.should == ''
- end
-
- it 'does not decrement pos' do
- @gz.ungetbyte nil
- @gz.pos.should == 10
- end
-
- it 'does not make eof? false' do
- @gz.ungetbyte nil
- @gz.eof?.should be_true
- end
- end
- end
- end
-end
diff --git a/spec/rubyspec/library/zlib/gzipreader/ungetc_spec.rb b/spec/rubyspec/library/zlib/gzipreader/ungetc_spec.rb
deleted file mode 100644
index 2d218e8d19..0000000000
--- a/spec/rubyspec/library/zlib/gzipreader/ungetc_spec.rb
+++ /dev/null
@@ -1,292 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require 'stringio'
-require 'zlib'
-
-describe 'GzipReader#ungetc' do
- before :each do
- @data = '12345abcde'
- @zip = [31, 139, 8, 0, 44, 220, 209, 71, 0, 3, 51, 52, 50, 54, 49, 77,
- 76, 74, 78, 73, 5, 0, 157, 5, 0, 36, 10, 0, 0, 0].pack('C*')
- @io = StringIO.new @zip
- end
-
- describe 'at the start of the stream' do
- before :each do
- @gz = Zlib::GzipReader.new(@io, external_encoding: Encoding::UTF_8)
- end
-
- describe 'with a single-byte character' do
- it 'prepends the character to the stream' do
- @gz.ungetc 'x'
- @gz.read.should == 'x12345abcde'
- end
-
- ruby_bug "#13616", ""..."2.6" do
- it 'decrements pos' do
- @gz.ungetc 'x'
- @gz.pos.should == -1
- end
- end
- end
-
- describe 'with a multi-byte character' do
- it 'prepends the character to the stream' do
- @gz.ungetc 'ŷ'
- @gz.read.should == 'ŷ12345abcde'
- end
-
- ruby_bug "#13616", ""..."2.6" do
- it 'decrements pos' do
- @gz.ungetc 'ŷ'
- @gz.pos.should == -2
- end
- end
- end
-
- describe 'with a multi-character string' do
- it 'prepends the characters to the stream' do
- @gz.ungetc 'xŷž'
- @gz.read.should == 'xŷž12345abcde'
- end
-
- ruby_bug "#13616", ""..."2.6" do
- it 'decrements pos' do
- @gz.ungetc 'xŷž'
- @gz.pos.should == -5
- end
- end
- end
-
- describe 'with an integer' do
- it 'prepends the corresponding character to the stream' do
- @gz.ungetc 0x21
- @gz.read.should == '!12345abcde'
- end
-
- ruby_bug "#13616", ""..."2.6" do
- it 'decrements pos' do
- @gz.ungetc 0x21
- @gz.pos.should == -1
- end
- end
- end
-
- describe 'with an empty string' do
- it 'does not prepend anything to the stream' do
- @gz.ungetc ''
- @gz.read.should == '12345abcde'
- end
-
- it 'does not decrement pos' do
- @gz.ungetc ''
- @gz.pos.should == 0
- end
- end
-
- quarantine! do # https://bugs.ruby-lang.org/issues/13675
- describe 'with nil' do
- it 'does not prepend anything to the stream' do
- @gz.ungetc nil
- @gz.read.should == '12345abcde'
- end
-
- it 'does not decrement pos' do
- @gz.ungetc nil
- @gz.pos.should == 0
- end
- end
- end
- end
-
- describe 'in the middle of the stream' do
- before :each do
- @gz = Zlib::GzipReader.new(@io, external_encoding: Encoding::UTF_8)
- @gz.read 5
- end
-
- describe 'with a single-byte character' do
- it 'inserts the character into the stream' do
- @gz.ungetc 'x'
- @gz.read.should == 'xabcde'
- end
-
- it 'decrements pos' do
- @gz.ungetc 'x'
- @gz.pos.should == 4
- end
- end
-
- describe 'with a multi-byte character' do
- it 'inserts the character into the stream' do
- @gz.ungetc 'ŷ'
- @gz.read.should == 'ŷabcde'
- end
-
- it 'decrements pos' do
- @gz.ungetc 'ŷ'
- @gz.pos.should == 3
- end
- end
-
- describe 'with a multi-character string' do
- it 'inserts the characters into the stream' do
- @gz.ungetc 'xŷž'
- @gz.read.should == 'xŷžabcde'
- end
-
- it 'decrements pos' do
- @gz.ungetc 'xŷž'
- @gz.pos.should == 0
- end
- end
-
- describe 'with an integer' do
- it 'inserts the corresponding character into the stream' do
- @gz.ungetc 0x21
- @gz.read.should == '!abcde'
- end
-
- it 'decrements pos' do
- @gz.ungetc 0x21
- @gz.pos.should == 4
- end
- end
-
- describe 'with an empty string' do
- it 'does not insert anything into the stream' do
- @gz.ungetc ''
- @gz.read.should == 'abcde'
- end
-
- it 'does not decrement pos' do
- @gz.ungetc ''
- @gz.pos.should == 5
- end
- end
-
- quarantine! do # https://bugs.ruby-lang.org/issues/13675
- describe 'with nil' do
- it 'does not insert anything into the stream' do
- @gz.ungetc nil
- @gz.read.should == 'abcde'
- end
-
- it 'does not decrement pos' do
- @gz.ungetc nil
- @gz.pos.should == 5
- end
- end
- end
- end
-
- describe 'at the end of the stream' do
- before :each do
- @gz = Zlib::GzipReader.new(@io, external_encoding: Encoding::UTF_8)
- @gz.read
- end
-
- describe 'with a single-byte character' do
- it 'appends the character to the stream' do
- @gz.ungetc 'x'
- @gz.read.should == 'x'
- end
-
- it 'decrements pos' do
- @gz.ungetc 'x'
- @gz.pos.should == 9
- end
-
- it 'makes eof? false' do
- @gz.ungetc 'x'
- @gz.eof?.should be_false
- end
- end
-
- describe 'with a multi-byte character' do
- it 'appends the character to the stream' do
- @gz.ungetc 'ŷ'
- @gz.read.should == 'ŷ'
- end
-
- it 'decrements pos' do
- @gz.ungetc 'ŷ'
- @gz.pos.should == 8
- end
-
- it 'makes eof? false' do
- @gz.ungetc 'ŷ'
- @gz.eof?.should be_false
- end
- end
-
- describe 'with a multi-character string' do
- it 'appends the characters to the stream' do
- @gz.ungetc 'xŷž'
- @gz.read.should == 'xŷž'
- end
-
- it 'decrements pos' do
- @gz.ungetc 'xŷž'
- @gz.pos.should == 5
- end
-
- it 'makes eof? false' do
- @gz.ungetc 'xŷž'
- @gz.eof?.should be_false
- end
- end
-
- describe 'with an integer' do
- it 'appends the corresponding character to the stream' do
- @gz.ungetc 0x21
- @gz.read.should == '!'
- end
-
- it 'decrements pos' do
- @gz.ungetc 0x21
- @gz.pos.should == 9
- end
-
- it 'makes eof? false' do
- @gz.ungetc 0x21
- @gz.eof?.should be_false
- end
- end
-
- describe 'with an empty string' do
- it 'does not append anything to the stream' do
- @gz.ungetc ''
- @gz.read.should == ''
- end
-
- it 'does not decrement pos' do
- @gz.ungetc ''
- @gz.pos.should == 10
- end
-
- it 'does not make eof? false' do
- @gz.ungetc ''
- @gz.eof?.should be_true
- end
- end
-
- quarantine! do # https://bugs.ruby-lang.org/issues/13675
- describe 'with nil' do
- it 'does not append anything to the stream' do
- @gz.ungetc nil
- @gz.read.should == ''
- end
-
- it 'does not decrement pos' do
- @gz.ungetc nil
- @gz.pos.should == 10
- end
-
- it 'does not make eof? false' do
- @gz.ungetc nil
- @gz.eof?.should be_true
- end
- end
- end
- end
-end
diff --git a/spec/rubyspec/library/zlib/gzipreader/unused_spec.rb b/spec/rubyspec/library/zlib/gzipreader/unused_spec.rb
deleted file mode 100644
index 6a4c1dadb4..0000000000
--- a/spec/rubyspec/library/zlib/gzipreader/unused_spec.rb
+++ /dev/null
@@ -1 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
diff --git a/spec/rubyspec/library/zlib/gzipwriter/append_spec.rb b/spec/rubyspec/library/zlib/gzipwriter/append_spec.rb
deleted file mode 100644
index 922e921840..0000000000
--- a/spec/rubyspec/library/zlib/gzipwriter/append_spec.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require 'stringio'
-require 'zlib'
-
-describe "Zlib::GzipWriter#<<" do
- before :each do
- @io = StringIO.new
- end
-
- it "returns self" do
- Zlib::GzipWriter.wrap @io do |gzio|
- (gzio << "test").should equal(gzio)
- end
- end
-
- it "needs to be reviewed for spec completeness"
-end
diff --git a/spec/rubyspec/library/zlib/gzipwriter/comment_spec.rb b/spec/rubyspec/library/zlib/gzipwriter/comment_spec.rb
deleted file mode 100644
index 6a4c1dadb4..0000000000
--- a/spec/rubyspec/library/zlib/gzipwriter/comment_spec.rb
+++ /dev/null
@@ -1 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
diff --git a/spec/rubyspec/library/zlib/gzipwriter/flush_spec.rb b/spec/rubyspec/library/zlib/gzipwriter/flush_spec.rb
deleted file mode 100644
index 6a4c1dadb4..0000000000
--- a/spec/rubyspec/library/zlib/gzipwriter/flush_spec.rb
+++ /dev/null
@@ -1 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
diff --git a/spec/rubyspec/library/zlib/gzipwriter/mtime_spec.rb b/spec/rubyspec/library/zlib/gzipwriter/mtime_spec.rb
deleted file mode 100644
index af7a4ac735..0000000000
--- a/spec/rubyspec/library/zlib/gzipwriter/mtime_spec.rb
+++ /dev/null
@@ -1,38 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require 'stringio'
-require 'zlib'
-
-describe "Zlib::GzipWriter#mtime=" do
- before :each do
- @io = StringIO.new
- end
-
- it "sets mtime using Integer" do
- Zlib::GzipWriter.wrap @io do |gzio|
- gzio.mtime = 1
-
- gzio.mtime.should == Time.at(1)
- end
-
- @io.string[4, 4].should == [1,0,0,0].pack('C*')
- end
-
- it "sets mtime using Time" do
- Zlib::GzipWriter.wrap @io do |gzio|
- gzio.mtime = Time.at 1
-
- gzio.mtime.should == Time.at(1)
- end
-
- @io.string[4, 4].should == [1,0,0,0].pack('C*')
- end
-
- it "raises if the header was written" do
- Zlib::GzipWriter.wrap @io do |gzio|
- gzio.write ''
-
- lambda { gzio.mtime = nil }.should \
- raise_error(Zlib::GzipFile::Error, 'header is already written')
- end
- end
-end
diff --git a/spec/rubyspec/library/zlib/gzipwriter/new_spec.rb b/spec/rubyspec/library/zlib/gzipwriter/new_spec.rb
deleted file mode 100644
index 6a4c1dadb4..0000000000
--- a/spec/rubyspec/library/zlib/gzipwriter/new_spec.rb
+++ /dev/null
@@ -1 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
diff --git a/spec/rubyspec/library/zlib/gzipwriter/open_spec.rb b/spec/rubyspec/library/zlib/gzipwriter/open_spec.rb
deleted file mode 100644
index 6a4c1dadb4..0000000000
--- a/spec/rubyspec/library/zlib/gzipwriter/open_spec.rb
+++ /dev/null
@@ -1 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
diff --git a/spec/rubyspec/library/zlib/gzipwriter/orig_name_spec.rb b/spec/rubyspec/library/zlib/gzipwriter/orig_name_spec.rb
deleted file mode 100644
index 6a4c1dadb4..0000000000
--- a/spec/rubyspec/library/zlib/gzipwriter/orig_name_spec.rb
+++ /dev/null
@@ -1 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
diff --git a/spec/rubyspec/library/zlib/gzipwriter/pos_spec.rb b/spec/rubyspec/library/zlib/gzipwriter/pos_spec.rb
deleted file mode 100644
index 6a4c1dadb4..0000000000
--- a/spec/rubyspec/library/zlib/gzipwriter/pos_spec.rb
+++ /dev/null
@@ -1 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
diff --git a/spec/rubyspec/library/zlib/gzipwriter/print_spec.rb b/spec/rubyspec/library/zlib/gzipwriter/print_spec.rb
deleted file mode 100644
index 6a4c1dadb4..0000000000
--- a/spec/rubyspec/library/zlib/gzipwriter/print_spec.rb
+++ /dev/null
@@ -1 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
diff --git a/spec/rubyspec/library/zlib/gzipwriter/printf_spec.rb b/spec/rubyspec/library/zlib/gzipwriter/printf_spec.rb
deleted file mode 100644
index 6a4c1dadb4..0000000000
--- a/spec/rubyspec/library/zlib/gzipwriter/printf_spec.rb
+++ /dev/null
@@ -1 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
diff --git a/spec/rubyspec/library/zlib/gzipwriter/putc_spec.rb b/spec/rubyspec/library/zlib/gzipwriter/putc_spec.rb
deleted file mode 100644
index 6a4c1dadb4..0000000000
--- a/spec/rubyspec/library/zlib/gzipwriter/putc_spec.rb
+++ /dev/null
@@ -1 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
diff --git a/spec/rubyspec/library/zlib/gzipwriter/puts_spec.rb b/spec/rubyspec/library/zlib/gzipwriter/puts_spec.rb
deleted file mode 100644
index 6a4c1dadb4..0000000000
--- a/spec/rubyspec/library/zlib/gzipwriter/puts_spec.rb
+++ /dev/null
@@ -1 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
diff --git a/spec/rubyspec/library/zlib/gzipwriter/tell_spec.rb b/spec/rubyspec/library/zlib/gzipwriter/tell_spec.rb
deleted file mode 100644
index 6a4c1dadb4..0000000000
--- a/spec/rubyspec/library/zlib/gzipwriter/tell_spec.rb
+++ /dev/null
@@ -1 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
diff --git a/spec/rubyspec/library/zlib/gzipwriter/write_spec.rb b/spec/rubyspec/library/zlib/gzipwriter/write_spec.rb
deleted file mode 100644
index 5ff4241423..0000000000
--- a/spec/rubyspec/library/zlib/gzipwriter/write_spec.rb
+++ /dev/null
@@ -1,36 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require 'stringio'
-require 'zlib'
-
-describe "GzipWriter#write" do
- before :each do
- @data = '12345abcde'
- @zip = [31, 139, 8, 0, 44, 220, 209, 71, 0, 3, 51, 52, 50, 54, 49, 77,
- 76, 74, 78, 73, 5, 0, 157, 5, 0, 36, 10, 0, 0, 0].pack('C*')
- @io = StringIO.new "".b
- end
-
- it "writes some compressed data" do
- Zlib::GzipWriter.wrap @io do |gzio|
- gzio.write @data
- end
-
- # skip gzip header for now
- @io.string.unpack('C*')[10..-1].should == @zip.unpack('C*')[10..-1]
- end
-
- it "returns the number of bytes in the input" do
- Zlib::GzipWriter.wrap @io do |gzio|
- gzio.write(@data).should == @data.size
- end
- end
-
- it "handles inputs of 2^23 bytes" do
- input = '.'.b * (2 ** 23)
-
- Zlib::GzipWriter.wrap @io do |gzio|
- gzio.write input
- end
- @io.string.size.should == 8176
- end
-end
diff --git a/spec/rubyspec/library/zlib/inflate/append_spec.rb b/spec/rubyspec/library/zlib/inflate/append_spec.rb
deleted file mode 100644
index a768a766a2..0000000000
--- a/spec/rubyspec/library/zlib/inflate/append_spec.rb
+++ /dev/null
@@ -1,60 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require 'zlib'
-
-describe "Zlib::Inflate#<<" do
- before :all do
- @foo_deflated = [120, 156, 75, 203, 207, 7, 0, 2, 130, 1, 69].pack('C*')
- end
-
- before :each do
- @z = Zlib::Inflate.new
- end
-
- after :each do
- @z.close unless @z.closed?
- end
-
- it "appends data to the input stream" do
- @z << @foo_deflated
- @z.finish.should == 'foo'
- end
-
- it "treats nil argument as the end of compressed data" do
- @z = Zlib::Inflate.new
- @z << @foo_deflated << nil
- @z.finish.should == 'foo'
- end
-
- it "just passes through the data after nil argument" do
- @z = Zlib::Inflate.new
- @z << @foo_deflated << nil
- @z << "-after_nil_data"
- @z.finish.should == 'foo-after_nil_data'
- end
-
- it "properly handles data in chunks" do
- # add bytes, one by one
- @foo_deflated.each_byte { |d| @z << d.chr}
- @z.finish.should == "foo"
- end
-
- it "properly handles incomplete data" do
- # add bytes, one by one
- @foo_deflated[0, 5].each_byte { |d| @z << d.chr}
- lambda { @z.finish }.should raise_error(Zlib::BufError)
- end
-
- it "properly handles excessive data, byte-by-byte" do
- # add bytes, one by one
- data = @foo_deflated * 2
- data.each_byte { |d| @z << d.chr}
- @z.finish.should == "foo" + @foo_deflated
- end
-
- it "properly handles excessive data, in one go" do
- # add bytes, one by one
- data = @foo_deflated * 2
- @z << data
- @z.finish.should == "foo" + @foo_deflated
- end
-end
diff --git a/spec/rubyspec/library/zlib/inflate/finish_spec.rb b/spec/rubyspec/library/zlib/inflate/finish_spec.rb
deleted file mode 100644
index f6e592fb6b..0000000000
--- a/spec/rubyspec/library/zlib/inflate/finish_spec.rb
+++ /dev/null
@@ -1,28 +0,0 @@
-require 'zlib'
-
-describe "Zlib::Inflate#finish" do
-
- before do
- @zeros = Zlib::Deflate.deflate("0" * 100_000)
- @inflator = Zlib::Inflate.new
- @chunks = []
-
- @inflator.inflate(@zeros) do |chunk|
- @chunks << chunk
- break
- end
-
- @inflator.finish do |chunk|
- @chunks << chunk
- end
- end
-
- it "inflates chunked data" do
- @chunks.map { |chunk| chunk.length }.should == [16384, 16384, 16384, 16384, 16384, 16384, 1696]
- end
-
- it "each chunk should have the same prefix" do
- @chunks.all? { |chunk| chunk =~ /\A0+\z/ }.should be_true
- end
-
-end
diff --git a/spec/rubyspec/library/zlib/inflate/inflate_spec.rb b/spec/rubyspec/library/zlib/inflate/inflate_spec.rb
deleted file mode 100644
index 1fa16d9e98..0000000000
--- a/spec/rubyspec/library/zlib/inflate/inflate_spec.rb
+++ /dev/null
@@ -1,152 +0,0 @@
-require 'zlib'
-require File.expand_path('../../../../spec_helper', __FILE__)
-
-describe "Zlib::Inflate#inflate" do
-
- before :each do
- @inflator = Zlib::Inflate.new
- end
- it "inflates some data" do
- data = [120, 156, 99, 96, 128, 1, 0, 0, 10, 0, 1].pack('C*')
- unzipped = @inflator.inflate data
- @inflator.finish
-
- unzipped.should == "\000" * 10
- end
-
- it "inflates lots of data" do
- data = [120, 156, 237, 193, 1, 1, 0, 0] +
- [0, 128, 144, 254, 175, 238, 8, 10] +
- Array.new(31, 0) +
- [24, 128, 0, 0, 1]
-
- unzipped = @inflator.inflate data.pack('C*')
- @inflator.finish
-
- unzipped.should == "\000" * 32 * 1024
- end
-
- it "works in pass-through mode, once finished" do
- data = [120, 156, 99, 96, 128, 1, 0, 0, 10, 0, 1]
- @inflator.inflate data.pack('C*')
- @inflator.finish # this is a precondition
-
- out = @inflator.inflate('uncompressed_data')
- out << @inflator.finish
- out.should == 'uncompressed_data'
-
- @inflator << ('uncompressed_data') << nil
- @inflator.finish.should == 'uncompressed_data'
- end
-
-end
-
-describe "Zlib::Inflate.inflate" do
-
- it "inflates some data" do
- data = [120, 156, 99, 96, 128, 1, 0, 0, 10, 0, 1]
- unzipped = Zlib::Inflate.inflate data.pack('C*')
-
- unzipped.should == "\000" * 10
- end
-
- it "inflates lots of data" do
- data = [120, 156, 237, 193, 1, 1, 0, 0] +
- [0, 128, 144, 254, 175, 238, 8, 10] +
- Array.new(31,0) +
- [24, 128, 0, 0, 1]
-
- zipped = Zlib::Inflate.inflate data.pack('C*')
-
- zipped.should == "\000" * 32 * 1024
- end
-
- it "properly handles data in chunks" do
- data = [120, 156, 75, 203, 207, 7, 0, 2, 130, 1, 69].pack('C*')
- z = Zlib::Inflate.new
- # add bytes, one by one
- result = ""
- data.each_byte { |d| result << z.inflate(d.chr)}
- result << z.finish
- result.should == "foo"
- end
-
- it "properly handles incomplete data" do
- data = [120, 156, 75, 203, 207, 7, 0, 2, 130, 1, 69].pack('C*')[0,5]
- z = Zlib::Inflate.new
- # add bytes, one by one, but not all
- result = ""
- data.each_byte { |d| result << z.inflate(d.chr)}
- lambda { result << z.finish }.should raise_error(Zlib::BufError)
- end
-
- it "properly handles excessive data, byte-by-byte" do
- main_data = [120, 156, 75, 203, 207, 7, 0, 2, 130, 1, 69].pack('C*')
- data = main_data * 2
- result = ""
-
- z = Zlib::Inflate.new
- # add bytes, one by one
- data.each_byte { |d| result << z.inflate(d.chr)}
- result << z.finish
-
- # the first chunk is inflated to its completion,
- # the second chunk is just passed through.
- result.should == "foo" + main_data
- end
-
- it "properly handles excessive data, in one go" do
- main_data = [120, 156, 75, 203, 207, 7, 0, 2, 130, 1, 69].pack('C*')
- data = main_data * 2
- result = ""
-
- z = Zlib::Inflate.new
- result << z.inflate(data)
- result << z.finish
-
- # the first chunk is inflated to its completion,
- # the second chunk is just passed through.
- result.should == "foo" + main_data
- end
-end
-
-describe "Zlib::Inflate#inflate" do
-
- before do
- @zeros = Zlib::Deflate.deflate("0" * 100_000)
- @inflator = Zlib::Inflate.new
- @chunks = []
- end
-
- describe "without break" do
-
- before do
- @inflator.inflate(@zeros) do |chunk|
- @chunks << chunk
- end
- end
-
- it "inflates chunked data" do
- @chunks.map { |chunk| chunk.size }.should == [16384, 16384, 16384, 16384, 16384, 16384, 1696]
- end
-
- it "properly handles chunked data" do
- @chunks.all? { |chunk| chunk =~ /\A0+\z/ }.should be_true
- end
- end
-
- describe "with break" do
-
- before do
- @inflator.inflate(@zeros) do |chunk|
- @chunks << chunk
- break
- end
- end
-
- it "inflates chunked break" do
- output = @inflator.inflate nil
- (100_000 - @chunks.first.length).should == output.length
- end
- end
-end
diff --git a/spec/rubyspec/library/zlib/inflate/new_spec.rb b/spec/rubyspec/library/zlib/inflate/new_spec.rb
deleted file mode 100644
index 6a4c1dadb4..0000000000
--- a/spec/rubyspec/library/zlib/inflate/new_spec.rb
+++ /dev/null
@@ -1 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
diff --git a/spec/rubyspec/library/zlib/inflate/set_dictionary_spec.rb b/spec/rubyspec/library/zlib/inflate/set_dictionary_spec.rb
deleted file mode 100644
index 890815b8e6..0000000000
--- a/spec/rubyspec/library/zlib/inflate/set_dictionary_spec.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-# -*- encoding: binary -*-
-require File.expand_path('../../../../spec_helper', __FILE__)
-require 'zlib'
-
-describe "Zlib::Inflate#set_dictionary" do
- it "sets the inflate dictionary" do
- deflated = "x\273\024\341\003\313KLJNIMK\317\310\314\002\000\025\206\003\370"
-
- i = Zlib::Inflate.new
-
- begin
- i << deflated
- flunk 'Zlib::NeedDict not raised'
- rescue Zlib::NeedDict
- i.set_dictionary 'aaaaaaaaaa'
- end
-
- i.finish.should == 'abcdefghij'
- end
-end
-
diff --git a/spec/rubyspec/library/zlib/inflate/sync_point_spec.rb b/spec/rubyspec/library/zlib/inflate/sync_point_spec.rb
deleted file mode 100644
index 6a4c1dadb4..0000000000
--- a/spec/rubyspec/library/zlib/inflate/sync_point_spec.rb
+++ /dev/null
@@ -1 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
diff --git a/spec/rubyspec/library/zlib/inflate/sync_spec.rb b/spec/rubyspec/library/zlib/inflate/sync_spec.rb
deleted file mode 100644
index 6a4c1dadb4..0000000000
--- a/spec/rubyspec/library/zlib/inflate/sync_spec.rb
+++ /dev/null
@@ -1 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
diff --git a/spec/rubyspec/library/zlib/zlib_version_spec.rb b/spec/rubyspec/library/zlib/zlib_version_spec.rb
deleted file mode 100644
index 14fb93ef07..0000000000
--- a/spec/rubyspec/library/zlib/zlib_version_spec.rb
+++ /dev/null
@@ -1 +0,0 @@
-require File.expand_path('../../../spec_helper', __FILE__)
diff --git a/spec/rubyspec/library/zlib/zstream/adler_spec.rb b/spec/rubyspec/library/zlib/zstream/adler_spec.rb
deleted file mode 100644
index e562fd260e..0000000000
--- a/spec/rubyspec/library/zlib/zstream/adler_spec.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require 'zlib'
-
-describe "Zlib::ZStream#adler" do
- it "generates hash" do
- z = Zlib::Deflate.new
- z << "foo"
- z.finish
- z.adler.should == 0x02820145
- end
-end
diff --git a/spec/rubyspec/library/zlib/zstream/avail_in_spec.rb b/spec/rubyspec/library/zlib/zstream/avail_in_spec.rb
deleted file mode 100644
index 25d3219a5a..0000000000
--- a/spec/rubyspec/library/zlib/zstream/avail_in_spec.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require 'zlib'
-
-describe "Zlib::ZStream#avail_in" do
- it "returns bytes in the input buffer" do
- z = Zlib::Deflate.new
- z.avail_in.should == 0
- end
-end
diff --git a/spec/rubyspec/library/zlib/zstream/avail_out_spec.rb b/spec/rubyspec/library/zlib/zstream/avail_out_spec.rb
deleted file mode 100644
index c747bbbc2f..0000000000
--- a/spec/rubyspec/library/zlib/zstream/avail_out_spec.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require 'zlib'
-
-describe "Zlib::ZStream#avail_out" do
- it "returns bytes in the output buffer" do
- z = Zlib::Deflate.new
- z.avail_out.should == 0
- end
-end
diff --git a/spec/rubyspec/library/zlib/zstream/close_spec.rb b/spec/rubyspec/library/zlib/zstream/close_spec.rb
deleted file mode 100644
index 6a4c1dadb4..0000000000
--- a/spec/rubyspec/library/zlib/zstream/close_spec.rb
+++ /dev/null
@@ -1 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
diff --git a/spec/rubyspec/library/zlib/zstream/closed_spec.rb b/spec/rubyspec/library/zlib/zstream/closed_spec.rb
deleted file mode 100644
index 6a4c1dadb4..0000000000
--- a/spec/rubyspec/library/zlib/zstream/closed_spec.rb
+++ /dev/null
@@ -1 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
diff --git a/spec/rubyspec/library/zlib/zstream/data_type_spec.rb b/spec/rubyspec/library/zlib/zstream/data_type_spec.rb
deleted file mode 100644
index 614f0d10a2..0000000000
--- a/spec/rubyspec/library/zlib/zstream/data_type_spec.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require 'zlib'
-
-describe "Zlib::ZStream#data_type" do
- it "returns the type of the data in the stream" do
- z = Zlib::Deflate.new
- [Zlib::ASCII, Zlib::BINARY, Zlib::UNKNOWN].include?(z.data_type).should == true
- end
-end
diff --git a/spec/rubyspec/library/zlib/zstream/end_spec.rb b/spec/rubyspec/library/zlib/zstream/end_spec.rb
deleted file mode 100644
index 6a4c1dadb4..0000000000
--- a/spec/rubyspec/library/zlib/zstream/end_spec.rb
+++ /dev/null
@@ -1 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
diff --git a/spec/rubyspec/library/zlib/zstream/ended_spec.rb b/spec/rubyspec/library/zlib/zstream/ended_spec.rb
deleted file mode 100644
index 6a4c1dadb4..0000000000
--- a/spec/rubyspec/library/zlib/zstream/ended_spec.rb
+++ /dev/null
@@ -1 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
diff --git a/spec/rubyspec/library/zlib/zstream/finish_spec.rb b/spec/rubyspec/library/zlib/zstream/finish_spec.rb
deleted file mode 100644
index 6a4c1dadb4..0000000000
--- a/spec/rubyspec/library/zlib/zstream/finish_spec.rb
+++ /dev/null
@@ -1 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
diff --git a/spec/rubyspec/library/zlib/zstream/finished_spec.rb b/spec/rubyspec/library/zlib/zstream/finished_spec.rb
deleted file mode 100644
index 6a4c1dadb4..0000000000
--- a/spec/rubyspec/library/zlib/zstream/finished_spec.rb
+++ /dev/null
@@ -1 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
diff --git a/spec/rubyspec/library/zlib/zstream/flush_next_in_spec.rb b/spec/rubyspec/library/zlib/zstream/flush_next_in_spec.rb
deleted file mode 100644
index 6a4c1dadb4..0000000000
--- a/spec/rubyspec/library/zlib/zstream/flush_next_in_spec.rb
+++ /dev/null
@@ -1 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
diff --git a/spec/rubyspec/library/zlib/zstream/flush_next_out_spec.rb b/spec/rubyspec/library/zlib/zstream/flush_next_out_spec.rb
deleted file mode 100644
index 8ba8414cd1..0000000000
--- a/spec/rubyspec/library/zlib/zstream/flush_next_out_spec.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require 'zlib'
-
-describe "Zlib::ZStream#flush_next_out" do
-
- it "flushes the stream and flushes the output buffer" do
- zs = Zlib::Inflate.new
- zs << [120, 156, 75, 203, 207, 7, 0, 2, 130, 1, 69].pack('C*')
-
- zs.flush_next_out.should == 'foo'
- zs.finished?.should == true
- zs.flush_next_out.should == ''
- end
-end
-
-
diff --git a/spec/rubyspec/library/zlib/zstream/reset_spec.rb b/spec/rubyspec/library/zlib/zstream/reset_spec.rb
deleted file mode 100644
index 6a4c1dadb4..0000000000
--- a/spec/rubyspec/library/zlib/zstream/reset_spec.rb
+++ /dev/null
@@ -1 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
diff --git a/spec/rubyspec/library/zlib/zstream/stream_end_spec.rb b/spec/rubyspec/library/zlib/zstream/stream_end_spec.rb
deleted file mode 100644
index 6a4c1dadb4..0000000000
--- a/spec/rubyspec/library/zlib/zstream/stream_end_spec.rb
+++ /dev/null
@@ -1 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
diff --git a/spec/rubyspec/library/zlib/zstream/total_in_spec.rb b/spec/rubyspec/library/zlib/zstream/total_in_spec.rb
deleted file mode 100644
index 6a4c1dadb4..0000000000
--- a/spec/rubyspec/library/zlib/zstream/total_in_spec.rb
+++ /dev/null
@@ -1 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
diff --git a/spec/rubyspec/library/zlib/zstream/total_out_spec.rb b/spec/rubyspec/library/zlib/zstream/total_out_spec.rb
deleted file mode 100644
index 6a4c1dadb4..0000000000
--- a/spec/rubyspec/library/zlib/zstream/total_out_spec.rb
+++ /dev/null
@@ -1 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)