(module file-test mzscheme
(require (planet "test.ss" ("schematics" "schemeunit.plt" 2)))
(require "file.ss")
(provide file-tests)
(define file-tests
(test-suite
"All tests for file"
(test-case
"make-directory-tree creates single directory"
(check-false (directory-exists? "testing"))
(make-directory-tree "testing")
(check-true (directory-exists? "testing"))
(delete-directory "testing"))
(test-case
"make-directory-tree creates list of directories"
(let ((dirs '("t1" "t2" "t3")))
(map (lambda (dir)
(check-false (directory-exists? dir)))
dirs)
(make-directory-tree dirs)
(map (lambda (dir)
(check-true (directory-exists? dir)))
dirs)
(map delete-directory dirs)))
(test-case
"make-directory-tree creates tree of directories"
(check-false (directory-exists? "a"))
(check-false (directory-exists? "a/b"))
(check-false (directory-exists? "a/c"))
(check-false (directory-exists? "a/c/d"))
(make-directory-tree '("a" ("b" "c" ("d"))))
(check-true (directory-exists? "a"))
(check-true (directory-exists? "a/b"))
(check-true (directory-exists? "a/c"))
(check-true (directory-exists? "a/c/d"))
(delete-directory "a/c/d")
(delete-directory "a/c")
(delete-directory "a/b")
(delete-directory "a"))
))
)