racket/collects/meta/drdr/archive-test.ss
Jay McCarthy 25e403156a Adding DrDr source to meta.
svn: r18315
2010-02-24 04:07:08 +00:00

33 lines
1.2 KiB
Scheme

#lang scheme
(require "path-utils.ss"
"archive.ss"
tests/eli-tester)
(define archive
"../test.archive")
(test
(create-archive archive (current-directory))
(for ([fp (in-list (directory-list* (current-directory)))]
#:when (file-exists? fp))
(test
(archive-extract-file archive (build-path (current-directory) fp)) => (file->bytes fp)))
(archive-extract-file archive "test") =error> #rx"not in the archive"
(archive-extract-file archive (build-path (current-directory) "test")) =error> #rx"not in the archive"
(archive-extract-file archive (build-path (current-directory) "static")) =error> #rx"not a file"
(archive-extract-file "archive-test.ss" (build-path (current-directory) "archive-test.ss")) =error> #rx"not a valid archive"
(directory-list->directory-list* (archive-directory-list archive (current-directory)))
=> (directory-list* (current-directory))
(archive-directory-exists? archive (current-directory)) => #t
(archive-directory-exists? archive (build-path (current-directory) "static")) => #t
(archive-directory-exists? archive (build-path (current-directory) "unknown")) => #f
(archive-directory-exists? archive (build-path (current-directory) "archive-test.ss")) => #f
)