diff options
author | Paul Duncan <pabs@pablotron.org> | 2016-08-10 08:08:47 -0400 |
---|---|---|
committer | Paul Duncan <pabs@pablotron.org> | 2016-08-10 08:08:47 -0400 |
commit | 4194b3c8edfe3429281194d91493d4b251abbd0a (patch) | |
tree | fc916540b3c146cfa589be86f15da3e239f72d5a /spec | |
parent | 24f3afd615e629f823c8b1c55edb873784e80401 (diff) | |
download | zip-crystal-4194b3c8edfe3429281194d91493d4b251abbd0a.tar.bz2 zip-crystal-4194b3c8edfe3429281194d91493d4b251abbd0a.zip |
add reader
Diffstat (limited to 'spec')
-rw-r--r-- | spec/zip_spec.cr | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/spec/zip_spec.cr b/spec/zip_spec.cr index a7e306c..7e66518 100644 --- a/spec/zip_spec.cr +++ b/spec/zip_spec.cr @@ -56,9 +56,40 @@ describe Zip::Writer do end describe Zip::Reader do - Zip.read(File.join(TEST_DIR, "test-string.zip")) do |zip| - zip.entries.each do |e| - pp e + it "reads an archive" do + Zip.read(File.join(TEST_DIR, "test-string.zip")) do |zip| + zip.entries.each do |e| + pp e.path + end + end + end + + it "reads an archive created by an external program" do + Zip.read(File.join(TEST_DIR, "real.zip")) do |zip| + zip.each do |e| + pp e.path + end + end + end + + it "reads an archive created by an external program" do + Zip.read(File.join(TEST_DIR, "real.zip")) do |zip| + zip.each do |e| + e.read(File.open("/dev/null", "wb")) + end + end + end + + it "reads all an archive's compressed entries" do + Zip.read(File.join(TEST_DIR, "test-many.zip")) do |zip| + zip.each do |e| + pp e.path + + io = MemoryIO.new + # e.read(STDOUT) + e.read(io) + io.close + end end end end |