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

Last change on this file since 35367 was 35367, checked in by kon, 16 months ago

compiled test will have 3 directory items (itself), fix compiler cleverness (just because ".." is a string doesn't make it a visible filename)

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