file-author.lsp 2.15 KB
Newer Older
1
2
3
4
5
6
7
8
9
;-*- Mode:     Lisp -*-
;;;; Author:   Paul Dietz
;;;; Created:  Tue Jan  6 05:41:06 2004
;;;; Contains: Tests of FILE-AUTHOR

(in-package :cl-test)

(deftest file-author.1
  (loop for pn in
sds's avatar
sds committed
10
11
12
13
14
        (directory (make-pathname :name :wild :type :wild
                                  :defaults *default-pathname-defaults*))
        for author = (file-author pn)
        unless (or (null author) (stringp author))
        collect (list pn author))
15
16
17
18
19
  nil)

(deftest file-author.2
  (let ((author (file-author "file-author.lsp")))
    (if (or (null author) (stringp author))
sds's avatar
sds committed
20
        nil
21
22
23
24
25
26
      author))
  nil)

(deftest file-author.3
  (let ((author (file-author #p"file-author.lsp")))
    (if (or (null author) (stringp author))
sds's avatar
sds committed
27
        nil
28
29
30
31
32
33
      author))
  nil)

(deftest file-author.4
  (let ((author (file-author (truename "file-author.lsp"))))
    (if (or (null author) (stringp author))
sds's avatar
sds committed
34
        nil
35
36
37
38
39
      author))
  nil)

(deftest file-author.5
  (let ((author (with-open-file (s "file-author.lsp" :direction :input)
sds's avatar
sds committed
40
                                (file-author s))))
41
    (if (or (null author) (stringp author))
sds's avatar
sds committed
42
        nil
43
44
45
46
47
      author))
  nil)

(deftest file-author.6
  (let ((author (let ((s (open "file-author.lsp" :direction :input)))
sds's avatar
sds committed
48
49
                  (close s)
                  (file-author s))))
50
    (if (or (null author) (stringp author))
sds's avatar
sds committed
51
        nil
52
53
54
      author))
  nil)

55
56
57
58
59
60
61
62
;;; Specialized string tests

(deftest file-author.7
  (do-special-strings
   (s "file-author.lsp" nil)
   (assert (equal (file-author s) (file-author "file-author.lsp"))))
  nil)

63
64
65
;;; FIXME
;;; Add LPN test

66
67
68
;;; Error tests

(deftest file-author.error.1
69
70
  (signals-error (file-author) program-error)
  t)
71
72

(deftest file-author.error.2
73
74
  (signals-error (file-author "file-author.lsp" nil) program-error)
  t)
75
76

(deftest file-author.error.3
77
  (signals-error-always
78
   (file-author (make-pathname :name :wild :type "lsp"
sds's avatar
sds committed
79
                               :defaults *default-pathname-defaults*))
80
   file-error)
81
  t t)
82
83

(deftest file-author.error.4
84
  (signals-error-always
85
   (file-author (make-pathname :name "file-author" :type :wild
sds's avatar
sds committed
86
                               :defaults *default-pathname-defaults*))
87
   file-error)
88
  t t)