pathname-host.lsp 2.02 KB
Newer Older
1 2 3 4 5
;-*- Mode:     Lisp -*-
;;;; Author:   Paul Dietz
;;;; Created:  Sat Dec  6 14:23:22 2003
;;;; Contains: Tests for PATHNAME-HOST

6

7

8

pfdietz's avatar
pfdietz committed
9

10 11
(deftest pathname-host.1
  (loop for p in *pathnames*
sds's avatar
sds committed
12
        always (eql (length (multiple-value-list (pathname-host p))) 1))
13 14 15 16
  t)

(deftest pathname-host.2
  (loop for p in *pathnames*
sds's avatar
sds committed
17
        always (eql (length (multiple-value-list (pathname-host p :case :local))) 1))
18 19 20 21
  t)

(deftest pathname-host.3
  (loop for p in *pathnames*
sds's avatar
sds committed
22
        always (eql (length (multiple-value-list (pathname-host p :case :common))) 1))
23 24 25 26
  t)

(deftest pathname-host.4
  (loop for p in *pathnames*
sds's avatar
sds committed
27
        always (eql (length (multiple-value-list (pathname-host p :allow-other-keys nil))) 1))
28 29 30 31
  t)

(deftest pathname-host.5
  (loop for p in *pathnames*
sds's avatar
sds committed
32 33
        always (eql (length (multiple-value-list
                             (pathname-host p :foo t :allow-other-keys t))) 1))
34 35 36 37
  t)

(deftest pathname-host.6
  (loop for p in *pathnames*
sds's avatar
sds committed
38 39 40 41
        always (eql (length (multiple-value-list
                             (pathname-host p :allow-other-keys t
                                            :allow-other-keys nil
                                            'foo t))) 1))
42 43
  t)

44 45 46
;;; section 19.3.2.1
(deftest pathname-host.7
  (loop for p in *logical-pathnames*
sds's avatar
sds committed
47 48
        when (eq (pathname-host p) :unspecific)
        collect p)
49 50
  nil)

pfdietz's avatar
pfdietz committed
51 52 53 54
(deftest pathname-host.8
  (do-special-strings (s "" nil) (pathname-host s))
  nil)

pfdietz's avatar
pfdietz committed
55
#|
56 57
(deftest pathname-host.9
  (loop for p in *pathnames*
sds's avatar
sds committed
58 59 60 61 62
        for host = (pathname-host p)
        unless (or (stringp host)
                   (and (listp host) (every #'stringp host))
                   (eql host :unspecific))
        collect (list p host))
63
  nil)
pfdietz's avatar
pfdietz committed
64
|#
65 66 67

;;; Error cases

68
(deftest pathname-host.error.1
69 70
  (signals-error (pathname-host) program-error)
  t)
71 72

(deftest pathname-host.error.2
pfdietz's avatar
pfdietz committed
73
  (check-type-error #'pathname-host #'could-be-pathname-designator)
74 75 76
  nil)

(deftest pathname-host.error.3
77
  (signals-error (pathname-host *default-pathname-defaults* '#:bogus t)
sds's avatar
sds committed
78
                 program-error)
79
  t)