1 ;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; indent-tabs-mode: nil -*-
3 ;;; --- iolib.pathnames test suite.
6 (in-package :iolib-tests
)
8 (in-suite :iolib.pathnames
)
10 (defmacro is-file-path
(path (directory name
))
14 (and (eql (file-path-host ,p
) :unspecific
)
15 (eql (file-path-device ,p
) :unspecific
)
16 (equal (file-path-directory ,p
) ',directory
)
17 (equal (file-path-name ,p
) ',name
))))))
19 (test parse-file-path
.1
20 (is-file-path (parse-file-path "")
23 (test parse-file-path
.2
24 (is-file-path (parse-file-path "" :as-directory t
)
27 (test parse-file-path
.3
28 (is-file-path (parse-file-path "" :expand-user t
)
31 (test parse-file-path
.4
32 (is-file-path (parse-file-path "" :as-directory t
:expand-user t
)
35 (test parse-file-path
.5
36 (is-file-path (parse-file-path "a")
39 (test parse-file-path
.6
40 (is-file-path (parse-file-path "a" :as-directory t
)
41 ((:relative
"a") nil
)))
43 (test parse-file-path
.7
44 (is-file-path (parse-file-path "a" :expand-user t
)
47 (test parse-file-path
.8
48 (is-file-path (parse-file-path "a" :as-directory t
:expand-user t
)
49 ((:relative
"a") nil
)))
51 (test parse-file-path
.9
52 (is-file-path (parse-file-path "a/")
53 ((:relative
"a") nil
)))
55 (test parse-file-path
.10
56 (is-file-path (parse-file-path "a/" :as-directory t
)
57 ((:relative
"a") nil
)))
59 (test parse-file-path
.11
60 (is-file-path (parse-file-path "a/" :expand-user t
)
61 ((:relative
"a") nil
)))
63 (test parse-file-path
.12
64 (is-file-path (parse-file-path "a/" :as-directory t
:expand-user t
)
65 ((:relative
"a") nil
)))
67 (test parse-file-path
.13
68 (is-file-path (parse-file-path "/a")
71 (test parse-file-path
.14
72 (is-file-path (parse-file-path "/a" :as-directory t
)
73 ((:absolute
"a") nil
)))
75 (test parse-file-path
.15
76 (is-file-path (parse-file-path "/a" :expand-user t
)
79 (test parse-file-path
.16
80 (is-file-path (parse-file-path "/a" :as-directory t
:expand-user t
)
81 ((:absolute
"a") nil
)))
83 (test parse-file-path
.17
84 (is-file-path (parse-file-path "/a/")
85 ((:absolute
"a") nil
)))
87 (test parse-file-path
.18
88 (is-file-path (parse-file-path "/a/" :as-directory t
)
89 ((:absolute
"a") nil
)))
91 (test parse-file-path
.19
92 (is-file-path (parse-file-path "/a/" :expand-user t
)
93 ((:absolute
"a") nil
)))
95 (test parse-file-path
.20
96 (is-file-path (parse-file-path "/a/" :as-directory t
:expand-user t
)
97 ((:absolute
"a") nil
)))
99 (test parse-file-path.expand-user
.1
100 (is-file-path (parse-file-path "~root")
101 ((:relative
) "~root")))
103 (test parse-file-path.expand-user
.2
104 (is-file-path (parse-file-path "~root" :as-directory t
)
105 ((:relative
"~root") nil
)))
107 (test parse-file-path.expand-user
.3
108 (is-file-path (parse-file-path "~root" :expand-user t
)
109 ((:absolute
"root") nil
)))
111 (test parse-file-path.expand-user
.4
112 (is-file-path (parse-file-path "~root" :as-directory t
:expand-user t
)
113 ((:absolute
"root") nil
)))
115 (test parse-file-path.expand-user
.5
116 (is-file-path (parse-file-path "/~root")
117 ((:absolute
) "~root")))
119 (test parse-file-path.expand-user
.6
120 (is-file-path (parse-file-path "/~root" :as-directory t
)
121 ((:absolute
"~root") nil
)))
123 (test parse-file-path.expand-user
.7
124 (is-file-path (parse-file-path "/~root" :expand-user t
)
125 ((:absolute
) "~root")))
127 (test parse-file-path.expand-user
.8
128 (is-file-path (parse-file-path "/~root" :as-directory t
:expand-user t
)
129 ((:absolute
"~root") nil
)))