pathname-name.lsp 2.05 KB
Newer Older
1 2 3 4 5 6 7
;-*- Mode:     Lisp -*-
;;;; Author:   Paul Dietz
;;;; Created:  Sat Dec  6 14:45:16 2003
;;;; Contains: Tests for PATHNAME-NAME

(in-package :cl-test)

pfdietz's avatar
pfdietz committed
8 9
(compile-and-load "pathnames-aux.lsp")

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

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

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

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

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

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

58 59 60
;;; section 19.3.2.1
(deftest pathname-name.7
  (loop for p in *logical-pathnames*
sds's avatar
sds committed
61 62
        when (eq (pathname-name p) :unspecific)
        collect p)
63 64
  nil)

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

69
(deftest pathname-name.error.1
70 71
  (signals-error (pathname-name) program-error)
  t)
72 73

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