host-namestring.lsp 1.28 KB
Newer Older
1 2 3 4 5
;-*- Mode:     Lisp -*-
;;;; Author:   Paul Dietz
;;;; Created:  Sun Sep 12 06:22:40 2004
;;;; Contains: Tests of HOST-NAMESTRING

6

7 8

(deftest host-namestring.1
9
    (let* ((vals (multiple-value-list
10
                  (host-namestring "host-namestring.txt")))
11 12 13 14 15 16 17 18
           (s (first vals)))
      (if (and (null (cdr vals))
               (or (null s)
                   (stringp s)
                   ;; (equal (host-namestring s) s)
                   ))
          :good
          vals))
19 20 21
  :good)

(deftest host-namestring.2
22
    (do-special-strings
23
        (s "host-namestring.txt" nil)
24 25 26 27 28
      (let ((ns (host-namestring s)))
        (when ns
          (assert (stringp ns))
          ;; (assert (string= (host-namestring ns) ns))
          )))
29 30 31
  nil)

(deftest host-namestring.3
32
    (let* ((name "host-namestring.txt")
33 34 35 36 37
           (pn (merge-pathnames (pathname name)))
           (name2 (with-open-file (s pn :direction :input)
                    (host-namestring s)))
           (name3 (host-namestring pn)))
      (or (equalt name2 name3) (list name2 name3)))
38 39 40 41 42
  t)

;;; Error tests

(deftest host-namestring.error.1
43
    (signals-error (host-namestring) program-error)
44 45 46
  t)

(deftest host-namestring.error.2
47
    (signals-error (host-namestring "host-namestring.txt" nil)
48
                   program-error)
49
  t)