pathname-device.lsp 2.06 KB
Newer Older
1 2 3 4 5
;-*- Mode:     Lisp -*-
;;;; Author:   Paul Dietz
;;;; Created:  Sat Dec  6 14:23:54 2003
;;;; Contains: Tests for PATHNAME-DEVICE

6

7

8

pfdietz's avatar
pfdietz committed
9

10 11
(deftest pathname-device.1
  (loop for p in *pathnames*
sds's avatar
sds committed
12 13 14 15
        for device = (pathname-device p)
        unless (or (stringp device)
                   (member device '(nil :wild :unspecific)))
        collect (list p device))
16 17 18 19
  nil)

(deftest pathname-device.2
  (loop for p in *pathnames*
sds's avatar
sds committed
20 21 22 23
        for device = (pathname-device p :case :local)
        unless (or (stringp device)
                   (member device '(nil :wild :unspecific)))
        collect (list p device))
24 25 26 27
  nil)

(deftest pathname-device.3
  (loop for p in *pathnames*
sds's avatar
sds committed
28 29 30 31
        for device = (pathname-device p :case :common)
        unless (or (stringp device)
                   (member device '(nil :wild :unspecific)))
        collect (list p device))
32 33 34 35
  nil)

(deftest pathname-device.4
  (loop for p in *pathnames*
sds's avatar
sds committed
36 37 38 39
        for device = (pathname-device p :allow-other-keys nil)
        unless (or (stringp device)
                   (member device '(nil :wild :unspecific)))
        collect (list p device))
40 41 42 43
  nil)

(deftest pathname-device.5
  (loop for p in *pathnames*
sds's avatar
sds committed
44 45 46 47
        for device = (pathname-device p :foo 'bar :allow-other-keys t)
        unless (or (stringp device)
                   (member device '(nil :wild :unspecific)))
        collect (list p device))
48 49 50 51
  nil)

(deftest pathname-device.6
  (loop for p in *pathnames*
sds's avatar
sds committed
52 53 54 55
        for device = (pathname-device p :allow-other-keys t :allow-other-keys nil :foo 'bar)
        unless (or (stringp device)
                   (member device '(nil :wild :unspecific)))
        collect (list p device))
56 57
  nil)

58 59 60
;;; section 19.3.2.1
(deftest pathname-device.7
  (loop for p in *logical-pathnames*
sds's avatar
sds committed
61
        always (eq (pathname-device p) :unspecific))
62 63
  t)

pfdietz's avatar
pfdietz committed
64 65 66 67
(deftest pathname-device.8
  (do-special-strings (s "" nil) (pathname-device s))
  nil)

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

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