private/tests/zip.ss
(module zip mzscheme
  (require (planet "io.ss" ("dherman" "io.plt" 1)))
  (require (planet "file.ss" ("dherman" "io.plt" 1)))
  (require (planet "test.ss" ("schematics" "schemeunit.plt" 1)))
  (require (planet "test.ss" ("dherman" "test.plt" 1)))
  (require (lib "port.ss"))
  (require "../../zip.ss")
  (require "../../unzip.ss")
  (require "util.ss")

  (define test:zip
    (make-test-suite
     "zip tests"
     (make-test-case "a single file entry"
                     (in-new-directory "sandbox"
                      (let ([abe.txt/actual (string->path "abe-actual.txt")])
                        (with-gettysburg-address abe.txt
                          (let ([expected (with-input-from-file abe.txt read-lines)])
                            (with-temporary-file abe.zip ("abe~a.zip" #f (current-directory))
                              (with-output-to-file abe.zip
                                (lambda ()
                                  (zip (list (path->relative-path abe.txt))))
                                'replace)
                              (with-input-from-file abe.zip
                                (lambda ()
                                  (unzip (current-input-port)
                                         (lambda (entry-name dir? in)
                                           (with-output-to-file abe.txt/actual
                                             (lambda ()
                                               (copy-port in (current-output-port))))))))
                              (assert-true (gettysburg-address? abe.txt/actual))))))))
     ;; TODO: test on a piped output stream, where I can't seek
     ))

  (define zip-tests
    (make-test-suite
     "All zip.ss tests"
     test:zip
     ))

  (provide zip-tests))