source: trunk/source/tests/ansi-tests/pathname.lsp @ 8991

Last change on this file since 8991 was 8991, checked in by gz, 12 years ago

Check in the gcl ansi test suite (original, in preparation for making local changes)

File size: 2.0 KB
Line 
1;-*- Mode:     Lisp -*-
2;;;; Author:   Paul Dietz
3;;;; Created:  Sat Nov 29 05:06:57 2003
4;;;; Contains: Tests of the function PATHNAME
5
6(in-package :cl-test)
7
8(deftest pathname.1
9  (loop for x in *pathnames*
10        always (eq x (pathname x)))
11  t)
12
13(deftest pathname.2
14  (equalt #p"ansi-aux.lsp" (pathname "ansi-aux.lsp"))
15  t)
16
17(deftest pathname.3
18  (let ((s (open "ansi-aux.lsp" :direction :input)))
19    (prog1 (equalt (truename (pathname s)) (truename #p"ansi-aux.lsp"))
20      (close s)))
21  t)
22
23(deftest pathname.4
24  (let ((s (open "ansi-aux.lsp" :direction :input)))
25    (close s)
26    (equalt (truename (pathname s)) (truename #p"ansi-aux.lsp")))
27  t)
28
29(deftest pathname.5
30  (loop for x in *logical-pathnames*
31        always (eq x (pathname x)))
32  t)
33
34(deftest pathname.6
35  (equalt #p"ansi-aux.lsp"
36          (pathname (make-array 12 :initial-contents "ansi-aux.lsp"
37                                :element-type 'base-char)))
38  t)
39
40(deftest pathname.7
41  (equalt #p"ansi-aux.lsp"
42          (pathname (make-array 15 :initial-contents "ansi-aux.lspXXX"
43                                :element-type 'base-char
44                                :fill-pointer 12)))
45  t)
46
47(deftest pathname.8
48  (equalt #p"ansi-aux.lsp"
49          (pathname (make-array 12 :initial-contents "ansi-aux.lsp"
50                                :element-type 'base-char
51                                :adjustable t)))
52  t)
53
54(deftest pathname.9
55  (equalt #p"ansi-aux.lsp"
56          (pathname (make-array 15 :initial-contents "ansi-aux.lspXXX"
57                                :element-type 'character
58                                :fill-pointer 12)))
59  t)
60
61(deftest pathname.10
62  (equalt #p"ansi-aux.lsp"
63          (pathname (make-array 12 :initial-contents "ansi-aux.lsp"
64                                :element-type 'character
65                                :adjustable t)))
66  t)
67
68(deftest pathname.11
69  (loop for etype in '(standard-char base-char character)
70        collect
71        (equalt #p"ansi-aux.lsp"
72                (pathname
73                 (let* ((s (make-array 15 :initial-contents "XXansi-aux.lspX"
74                                       :element-type etype)))
75                   (make-array 12 :element-type etype
76                               :displaced-to s
77                               :displaced-index-offset 2)))))
78  (t t t))
79
80;;; Error tests
81
82(deftest pathname.error.1
83  (signals-error (pathname) program-error)
84  t)
85
86(deftest pathname.error.2
87  (signals-error (pathname (first *pathnames*) nil) program-error)
88  t)
Note: See TracBrowser for help on using the repository browser.