~ubuntu-branches/ubuntu/quantal/gclcvs/quantal

« back to all changes in this revision

Viewing changes to ansi-tests/delete-file.lsp

  • Committer: Bazaar Package Importer
  • Author(s): Camm Maguire
  • Date: 2004-06-24 15:13:46 UTC
  • Revision ID: james.westby@ubuntu.com-20040624151346-xh0xaaktyyp7aorc
Tags: 2.7.0-26
C_GC_OFFSET is 2 on m68k-linux

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
;-*- Mode:     Lisp -*-
 
2
;;;; Author:   Paul Dietz
 
3
;;;; Created:  Tue Jan 13 18:42:29 2004
 
4
;;;; Contains: Tests for DELETE-FILE
 
5
 
 
6
(in-package :cl-test)
 
7
 
 
8
(deftest delete-file.1
 
9
  (let ((pn "scratchfile.txt"))
 
10
    (unless (probe-file pn)
 
11
      (with-open-file (s pn :direction :output)
 
12
                      (format s "Contents~%")))
 
13
    (values
 
14
     (notnot (probe-file pn))
 
15
     (multiple-value-list (delete-file pn))
 
16
     (probe-file pn)))
 
17
  t (t) nil)
 
18
 
 
19
(deftest delete-file.2
 
20
  (let ((pn #p"scratchfile.txt"))
 
21
    (unless (probe-file pn)
 
22
      (with-open-file (s pn :direction :output)
 
23
                      (format s "Contents~%")))
 
24
    (values
 
25
     (notnot (probe-file pn))
 
26
     (multiple-value-list (delete-file pn))
 
27
     (probe-file pn)))
 
28
  t (t) nil)
 
29
 
 
30
(deftest delete-file.3
 
31
  (let ((pn "CLTEST:scratchfile.txt"))
 
32
    (unless (probe-file pn)
 
33
      (with-open-file (s pn :direction :output)
 
34
                      (format s "Contents~%")))
 
35
    (values
 
36
     (notnot (probe-file pn))
 
37
     (multiple-value-list (delete-file pn))
 
38
     (probe-file pn)))
 
39
  t (t) nil)
 
40
 
 
41
(deftest delete-file.4
 
42
  (let ((pn "CLTEST:scratchfile.txt"))
 
43
    (unless (probe-file pn)
 
44
      (with-open-file (s pn :direction :output)
 
45
                      (format s "Contents~%")))
 
46
    (let ((s (open pn :direction :input)))
 
47
      (close s)
 
48
      (values
 
49
       (notnot (probe-file pn))
 
50
       (multiple-value-list (delete-file s))
 
51
       (probe-file pn))))
 
52
  t (t) nil)
 
53
 
 
54
;;;
 
55
 
 
56
(deftest delete-file.error.1
 
57
  (signals-error (delete-file) program-error)
 
58
  t)
 
59
 
 
60
(deftest delete-file.error.2
 
61
  (let ((pn "scratch.txt"))
 
62
    (unless (probe-file pn)
 
63
      (with-open-file (s pn :direction :output)
 
64
                      (format s "Contents~%")))
 
65
    (values
 
66
     (notnot (probe-file pn))
 
67
     (signals-error (delete-file "scratch.txt" nil) program-error)
 
68
     (notnot (probe-file pn))
 
69
     (delete-file pn)
 
70
     (probe-file pn)))
 
71
  t t t t nil)
 
72
 
 
73
#|
 
74
(deftest delete-file.error.3
 
75
  (let ((pn "nonexistent.txt"))
 
76
    (when (probe-file pn) (delete-file pn))
 
77
    (signals-error (delete-file "nonexistent.txt") file-error))
 
78
  t)
 
79
|#
 
80