source: project/release/4/directory-utils/trunk/tests/directory-utils-test.scm

Last change on this file was 35371, checked in by Kon Lovett, 17 months ago

directory is symbolic for test

File size: 1.5 KB
Line 
1;;;; directory-utils-test.scm
2
3(use test)
4
5(use directory-utils)
6
7(test-begin "directory-utils")
8
9(test-assert (pathname? "abc/cbs.foo"))
10(test-assert (pathname? "abc/cbs"))
11(test-assert (pathname? ".abc"))
12(test-assert (not (pathname? "")))
13
14(test-assert (not (filename? "abc/cbs.foo")))
15(test-assert (filename? "cbs.foo"))
16
17(test-assert (not (dot-pathname? "abc/cbs.foo")))
18(test-assert (dot-pathname? "/abc/.hide/hidden"))
19(test-assert (not (dot-pathname? "/abc/cbs/./foo")))
20(test-assert (not (dot-pathname? "/abc/cbs/../foo")))
21(test-assert (dot-pathname? "/abc/cbs/../.foo"))
22(test-assert (dot-pathname? "/abc/cbs/../.foo/bar"))
23
24(test-assert (dot-filename? ".hide"))
25(test-assert (not (dot-filename? "/abc/.hide/hidden")))
26(test-assert (not (dot-filename? ".")))
27(test-assert (not (dot-filename? "..")))
28
29(test '("abc/cbs.foo") (remove-dotfiles '(".hide" "abc/cbs.foo")))
30
31(test-assert (which-command-pathnames "mkdir"))
32(test-assert (not (which-command-pathnames "93274030#$%)#)$()")))
33
34(cond-expand
35  (compiling (define-constant TESTS-DIRECTORY-COUNT 3))
36  (else (define-constant TESTS-DIRECTORY-COUNT 2)) )
37
38(test "directory-fold tests"
39  TESTS-DIRECTORY-COUNT
40  (directory-fold (lambda (fn ct) (fx+ ct 1)) 0 "." #:dotfiles? #f))
41
42(test-assert (push-directory ".."))
43
44(define-constant EGG-DIRECTORY-COUNT 4)
45
46(let ((dotno (directory-fold (lambda (fn ct) (fx+ ct 1)) 0 "." #:dotfiles? #f)))
47  (test-assert "directory-fold tests/.." (<= EGG-DIRECTORY-COUNT dotno)) )
48
49(test-assert (pop-toplevel-directory)) ;(pop-directory)
50
51(test-end "directory-utils")
52
53(test-exit)
Note: See TracBrowser for help on using the repository browser.