Commit f621429f authored by pfdietz's avatar pfdietz

Enhance some error tests to include unsafe code.

parent 4ef6d8ef
...@@ -143,12 +143,12 @@ ...@@ -143,12 +143,12 @@
;; Need to add a LPN test ;; Need to add a LPN test
(deftest ensure-directories-exist.error.1 (deftest ensure-directories-exist.error.1
(signals-error (signals-error-always
(ensure-directories-exist (ensure-directories-exist
(make-pathname :directory '(:relative :wild) (make-pathname :directory '(:relative :wild)
:defaults *default-pathname-defaults*)) :defaults *default-pathname-defaults*))
file-error) file-error)
t) t t)
(deftest ensure-directories-exist.error.2 (deftest ensure-directories-exist.error.2
(signals-error (ensure-directories-exist) program-error) (signals-error (ensure-directories-exist) program-error)
......
...@@ -66,28 +66,15 @@ ...@@ -66,28 +66,15 @@
t) t)
(deftest file-author.error.3 (deftest file-author.error.3
(signals-error (signals-error-always
(file-author (make-pathname :name :wild :type "lsp" (file-author (make-pathname :name :wild :type "lsp"
:defaults *default-pathname-defaults*)) :defaults *default-pathname-defaults*))
file-error) file-error)
t) t t)
(deftest file-author.error.4 (deftest file-author.error.4
(signals-error (signals-error-always
(file-author (make-pathname :name "file-author" :type :wild (file-author (make-pathname :name "file-author" :type :wild
:defaults *default-pathname-defaults*)) :defaults *default-pathname-defaults*))
file-error) file-error)
t) t t)
...@@ -65,15 +65,15 @@ ...@@ -65,15 +65,15 @@
t) t)
(deftest file-write-date.error.3 (deftest file-write-date.error.3
(signals-error (signals-error-always
(file-write-date (make-pathname :name :wild :type "lsp" (file-write-date (make-pathname :name :wild :type "lsp"
:defaults *default-pathname-defaults*)) :defaults *default-pathname-defaults*))
file-error) file-error)
t) t t)
(deftest file-write-date.error.4 (deftest file-write-date.error.4
(signals-error (signals-error-always
(file-write-date (make-pathname :name "file-write-date" :type :wild (file-write-date (make-pathname :name "file-write-date" :type :wild
:defaults *default-pathname-defaults*)) :defaults *default-pathname-defaults*))
file-error) file-error)
t) t t)
...@@ -1102,135 +1102,135 @@ ...@@ -1102,135 +1102,135 @@
t) t)
(deftest open.error.2 (deftest open.error.2
(signals-error (signals-error-always
(let ((pn #p"tmp.dat")) (let ((pn #p"tmp.dat"))
(close (open pn :direction :output :if-does-not-exist :create)) (close (open pn :direction :output :if-does-not-exist :create))
(open pn :if-exists :error :direction :output)) (open pn :if-exists :error :direction :output))
file-error) file-error)
t) t t)
(deftest open.error.3 (deftest open.error.3
(signals-error (signals-error-always
(let ((pn #p"tmp.dat")) (let ((pn #p"tmp.dat"))
(close (open pn :direction :output :if-does-not-exist :create)) (close (open pn :direction :output :if-does-not-exist :create))
(open pn :if-exists :error :direction :io)) (open pn :if-exists :error :direction :io))
file-error) file-error)
t) t t)
(deftest open.error.4 (deftest open.error.4
(signals-error (signals-error-always
(let ((pn #p"tmp.dat")) (let ((pn #p"tmp.dat"))
(delete-all-versions pn) (delete-all-versions pn)
(open pn)) (open pn))
file-error) file-error)
t) t t)
(deftest open.error.5 (deftest open.error.5
(signals-error (signals-error-always
(let ((pn #p"tmp.dat")) (let ((pn #p"tmp.dat"))
(delete-all-versions pn) (delete-all-versions pn)
(open pn :if-does-not-exist :error)) (open pn :if-does-not-exist :error))
file-error) file-error)
t) t t)
(deftest open.error.6 (deftest open.error.6
(signals-error (signals-error-always
(let ((pn #p"tmp.dat")) (let ((pn #p"tmp.dat"))
(delete-all-versions pn) (delete-all-versions pn)
(open pn :direction :input)) (open pn :direction :input))
file-error) file-error)
t) t t)
(deftest open.error.7 (deftest open.error.7
(signals-error (signals-error-always
(let ((pn #p"tmp.dat")) (let ((pn #p"tmp.dat"))
(delete-all-versions pn) (delete-all-versions pn)
(open pn :if-does-not-exist :error :direction :input)) (open pn :if-does-not-exist :error :direction :input))
file-error) file-error)
t) t t)
(deftest open.error.8 (deftest open.error.8
(signals-error (signals-error-always
(let ((pn #p"tmp.dat")) (let ((pn #p"tmp.dat"))
(delete-all-versions pn) (delete-all-versions pn)
(open pn :direction :output :if-does-not-exist :error)) (open pn :direction :output :if-does-not-exist :error))
file-error) file-error)
t) t t)
(deftest open.error.9 (deftest open.error.9
(signals-error (signals-error-always
(let ((pn #p"tmp.dat")) (let ((pn #p"tmp.dat"))
(delete-all-versions pn) (delete-all-versions pn)
(open pn :direction :io :if-does-not-exist :error)) (open pn :direction :io :if-does-not-exist :error))
file-error) file-error)
t) t t)
(deftest open.error.10 (deftest open.error.10
(signals-error (signals-error-always
(let ((pn #p"tmp.dat")) (let ((pn #p"tmp.dat"))
(delete-all-versions pn) (delete-all-versions pn)
(open pn :direction :probe :if-does-not-exist :error)) (open pn :direction :probe :if-does-not-exist :error))
file-error) file-error)
t) t t)
(deftest open.error.11 (deftest open.error.11
(signals-error (signals-error-always
(let ((pn #p"tmp.dat")) (let ((pn #p"tmp.dat"))
(delete-all-versions pn) (delete-all-versions pn)
(open pn :direction :output :if-exists :overwrite)) (open pn :direction :output :if-exists :overwrite))
file-error) file-error)
t) t t)
(deftest open.error.12 (deftest open.error.12
(signals-error (signals-error-always
(let ((pn #p"tmp.dat")) (let ((pn #p"tmp.dat"))
(delete-all-versions pn) (delete-all-versions pn)
(open pn :direction :output :if-exists :append)) (open pn :direction :output :if-exists :append))
file-error) file-error)
t) t t)
(deftest open.error.13 (deftest open.error.13
(signals-error (signals-error-always
(let ((pn #p"tmp.dat")) (let ((pn #p"tmp.dat"))
(delete-all-versions pn) (delete-all-versions pn)
(open pn :direction :io :if-exists :overwrite)) (open pn :direction :io :if-exists :overwrite))
file-error) file-error)
t) t t)
(deftest open.error.14 (deftest open.error.14
(signals-error (signals-error-always
(let ((pn #p"tmp.dat")) (let ((pn #p"tmp.dat"))
(delete-all-versions pn) (delete-all-versions pn)
(open pn :direction :io :if-exists :append)) (open pn :direction :io :if-exists :append))
file-error) file-error)
t) t t)
(deftest open.error.15 (deftest open.error.15
(signals-error (signals-error-always
(open (make-pathname :name :wild :type "lsp")) (open (make-pathname :name :wild :type "lsp"))
file-error) file-error)
t) t t)
(deftest open.error.16 (deftest open.error.16
(signals-error (signals-error-always
(open (make-pathname :name "open" :type :wild)) (open (make-pathname :name "open" :type :wild))
file-error) file-error)
t) t t)
(deftest open.error.17 (deftest open.error.17
(signals-error (signals-error-always
(let ((pn (make-pathname :name "open" :type "lsp" :version :wild))) (let ((pn (make-pathname :name "open" :type "lsp" :version :wild)))
(if (wild-pathname-p pn) (open pn) (if (wild-pathname-p pn) (open pn)
(error 'file-error))) (error 'file-error)))
file-error) file-error)
t) t t)
(deftest open.error.18 (deftest open.error.18
(signals-error (signals-error-always
(open #p"tmp.dat" :direction :output :if-exists :supersede (open #p"tmp.dat" :direction :output :if-exists :supersede
:external-form (gensym)) :external-form (gensym))
error) error)
t) t t)
;;; FIXME -- add tests for :element-type :default ;;; FIXME -- add tests for :element-type :default
\ No newline at end of file
...@@ -284,36 +284,36 @@ ...@@ -284,36 +284,36 @@
(deftest peek-char.error.2 (deftest peek-char.error.2
(signals-error (signals-error-always
(with-input-from-string (with-input-from-string
(*standard-input* "") (*standard-input* "")
(peek-char)) (peek-char))
end-of-file) end-of-file)
t) t t)
(deftest peek-char.error.3 (deftest peek-char.error.3
(signals-error (signals-error-always
(with-input-from-string (with-input-from-string
(s "") (s "")
(peek-char nil s)) (peek-char nil s))
end-of-file) end-of-file)
t) t t)
(deftest peek-char.error.4 (deftest peek-char.error.4
(signals-error (signals-error-always
(with-input-from-string (with-input-from-string
(s " ") (s " ")
(peek-char t s)) (peek-char t s))
end-of-file) end-of-file)
t) t t)
(deftest peek-char.error.5 (deftest peek-char.error.5
(signals-error (signals-error-always
(with-input-from-string (with-input-from-string
(s "abcd") (s "abcd")
(peek-char #\z s)) (peek-char #\z s))
end-of-file) end-of-file)
t) t t)
;;; There was a consensus on comp.lang.lisp that the requirement ;;; There was a consensus on comp.lang.lisp that the requirement
;;; that an end-of-file error be thrown in the following case ;;; that an end-of-file error be thrown in the following case
......
...@@ -38,9 +38,9 @@ ...@@ -38,9 +38,9 @@
t) t)
(deftest probe-file.error.3 (deftest probe-file.error.3
(signals-error (probe-file (make-pathname :name :wild)) file-error) (signals-error-always (probe-file (make-pathname :name :wild)) file-error)
t) t t)
(deftest probe-file.error.4 (deftest probe-file.error.4
(signals-error (probe-file "CLTEST:*.FOO") file-error) (signals-error-always (probe-file "CLTEST:*.FOO") file-error)
t) t t)
...@@ -115,21 +115,21 @@ ...@@ -115,21 +115,21 @@
t) t)
(deftest read-byte.error.4 (deftest read-byte.error.4
(progn (signals-error-always
(let ((s (open "foo.txt" (progn
:direction :output
:if-exists :supersede
:element-type '(unsigned-byte 8))))
(close s))
(signals-error
(let ((s (open "foo.txt" (let ((s (open "foo.txt"
:direction :input :direction :output
:element-type '(unsigned-byte 8)))) :if-exists :supersede
:element-type '(unsigned-byte 8))))
(close s))
(let ((s (open "foo.txt"
:direction :input
:element-type '(unsigned-byte 8))))
(unwind-protect (unwind-protect
(read-byte s t) (read-byte s t)
(close s))) (close s))))
end-of-file)) end-of-file)
t) t t)
(deftest read-byte.error.5 (deftest read-byte.error.5
(loop for x in *mini-universe* (loop for x in *mini-universe*
......
...@@ -99,25 +99,25 @@ ...@@ -99,25 +99,25 @@
t) t)
(deftest read-char-no-hang.error.2 (deftest read-char-no-hang.error.2
(signals-error (signals-error-always
(with-input-from-string (with-input-from-string
(s "") (s "")
(read-char-no-hang s)) (read-char-no-hang s))
end-of-file) end-of-file)
t) t t)
(deftest read-char-no-hang.error.3 (deftest read-char-no-hang.error.3
(signals-error (signals-error-always
(with-input-from-string (with-input-from-string
(s "") (s "")
(read-char-no-hang s t)) (read-char-no-hang s t))
end-of-file) end-of-file)
t) t t)
(deftest read-char-no-hang.error.4 (deftest read-char-no-hang.error.4
(signals-error (signals-error-always
(with-input-from-string (with-input-from-string
(s "") (s "")
(read-char-no-hang s t t)) (read-char-no-hang s t t))
end-of-file) end-of-file)
t) t t)
...@@ -97,25 +97,25 @@ ...@@ -97,25 +97,25 @@
t) t)
(deftest read-char.error.2 (deftest read-char.error.2
(signals-error (signals-error-always
(with-input-from-string (with-input-from-string
(s "") (s "")
(read-char s)) (read-char s))
end-of-file) end-of-file)
t) t t)
(deftest read-char.error.3 (deftest read-char.error.3
(signals-error (signals-error-always
(with-input-from-string (with-input-from-string
(s "") (s "")
(read-char s t)) (read-char s t))
end-of-file) end-of-file)
t) t t)
(deftest read-char.error.4 (deftest read-char.error.4
(signals-error (signals-error-always
(with-input-from-string (with-input-from-string
(s "") (s "")
(read-char s t t)) (read-char s t t))
end-of-file) end-of-file)
t) t t)
...@@ -79,26 +79,26 @@ ...@@ -79,26 +79,26 @@
t) t)
(deftest read-line.error.2 (deftest read-line.error.2
(signals-error (signals-error-always
(with-input-from-string (with-input-from-string
(s "") (s "")
(read-line s)) (read-line s))
end-of-file) end-of-file)
t) t t)
(deftest read-line.error.3 (deftest read-line.error.3
(signals-error (signals-error-always
(with-input-from-string (with-input-from-string
(*standard-input* "") (*standard-input* "")
(read-line)) (read-line))
end-of-file) end-of-file)
t) t t)
(deftest read-line.error.4 (deftest read-line.error.4
(signals-error (signals-error-always
(with-input-from-string (with-input-from-string
(s "") (s "")
(read-line s t)) (read-line s t))
end-of-file) end-of-file)
t) t t)
...@@ -80,25 +80,21 @@ ...@@ -80,25 +80,21 @@
t) t)
(deftest truename.error.3 (deftest truename.error.3
(signals-error (truename "nonexistent") file-error) (signals-error-always (truename "nonexistent") file-error)
t) t t)
(deftest truename.error.4 (deftest truename.error.4
(signals-error (truename #p"nonexistent") file-error) (signals-error-always (truename #p"nonexistent") file-error)
t) t t)
(deftest truename.error.5 (deftest truename.error.5
(signals-error (truename (logical-pathname "CLTESTROOT:nonexistent")) file-error) (signals-error-always (truename (logical-pathname "CLTESTROOT:nonexistent")) file-error)
t) t t)
(deftest truename.error.6 (deftest truename.error.6
(signals-error (signals-error-always
(let ((pn (make-pathname :name :wild (let ((pn (make-pathname :name :wild
:defaults *default-pathname-defaults*))) :defaults *default-pathname-defaults*)))
(truename pn)) file-error) (truename pn))
t) file-error)
t t)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment