aboutsummaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/zip_spec.cr37
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