(module file mzscheme (require (planet "test.ss" ("schematics" "schemeunit.plt" 1))) (require "../../file.ss") (require (lib "etc.ss")) (require (lib "file.ss")) (define collects-directory (normalize-path (build-path (this-expression-source-directory) 'up 'up 'up))) (define this-directory-relative-path (build-path "io" "private" "tests")) (define this-file-relative-path (build-path this-directory-relative-path "file.ss")) (define-syntax in-collects-directory (syntax-rules () [(_ e1 e2 ...) (parameterize ([current-directory collects-directory]) e1 e2 ...)])) (define file-tests (make-test-suite "All file.ss tests" (make-test-case "a file has as many subdirectories as its containing directory" (assert = (length (in-collects-directory (collect-subdirectories this-directory-relative-path))) (length (in-collects-directory (collect-subdirectories this-file-relative-path))))) (make-test-case "path-normalized=? normalizes paths before checking" (assert-true (in-collects-directory (path-normalized=? (build-path this-directory-relative-path 'up 'up 'up "io" "private" "tests") this-directory-relative-path)))) (make-test-case "a file is distinct from its parent directory" (assert-false (in-collects-directory (path=? this-directory-relative-path this-file-relative-path)))) )) (provide file-tests))