Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Karsten Poeck
ansi-test
Commits
df971c18
Commit
df971c18
authored
Jan 08, 2004
by
pfdietz
Browse files
Begin adding tests for RENAME-FILE.
parent
121a0595
Changes
2
Hide whitespace changes
Inline
Side-by-side
ansi-tests/load-files.lsp
View file @
df971c18
...
...
@@ -11,4 +11,5 @@
(load "truename.lsp")
(load "file-author.lsp")
(load "file-write-date.lsp")
(load "rename-file.lsp")
ansi-tests/rename-file.lsp
0 → 100644
View file @
df971c18
;-*- Mode: Lisp -*-
;;;; Author: Paul Dietz
;;;; Created: Thu Jan 8 06:22:53 2004
;;;; Contains: Tests for RENAME-FILE
(in-package :cl-test)
(deftest rename-file.1
(let ((pn1 #p"file-to-be-renamed.txt")
(pn2 #p"file-that-was-renamed.txt"))
(when (probe-file pn1)
(delete-file pn1))
(when (probe-file pn2)
(delete-file pn2))
(with-open-file (s pn1 :direction :output) (format s "Whatever~%"))
(let ((results (multiple-value-list (rename-file pn1 pn2))))
(destructuring-bind (defaulted-new-name old-truename new-truename)
results
(values
(=t (length results) 3)
(probe-file pn1)
(notnot (probe-file pn2))
(notnot (probe-file defaulted-new-name))
(probe-file old-truename)
(notnot (probe-file new-truename))))))
t nil t t nil t)
(deftest rename-file.2
(let ((pn1 "file-to-be-renamed.txt")
(pn2 "file-that-was-renamed.txt"))
(when (probe-file pn1)
(delete-file pn1))
(when (probe-file pn2)
(delete-file pn2))
(with-open-file (s pn1 :direction :output) (format s "Whatever~%"))
(let ((results (multiple-value-list (rename-file pn1 pn2))))
(destructuring-bind (defaulted-new-name old-truename new-truename)
results
(values
(=t (length results) 3)
(probe-file pn1)
(notnot (probe-file pn2))
(notnot (probe-file defaulted-new-name))
(probe-file old-truename)
(notnot (probe-file new-truename))))))
t nil t t nil t)
(deftest rename-file.3
(let* ((pn1 (make-pathname :name "file-to-be-renamed"
:type "txt"
:version :newest
:defaults *default-pathname-defaults*))
(pn2 (make-pathname :name "file-that-was-renamed"))
(pn3 (make-pathname :name "file-that-was-renamed"
:defaults pn1)))
(when (probe-file pn1)
(delete-file pn1))
(when (probe-file pn3)
(delete-file pn3))
(with-open-file (s pn1 :direction :output) (format s "Whatever~%"))
(let ((results (multiple-value-list (rename-file pn1 pn2))))
(destructuring-bind (defaulted-new-name old-truename new-truename)
results
(values
(equalpt (pathname-type pn1)
(pathname-type defaulted-new-name))
(=t (length results) 3)
(probe-file pn1)
(notnot (probe-file pn3))
(notnot (probe-file defaulted-new-name))
(probe-file old-truename)
(notnot (probe-file new-truename))))))
t t nil t t nil t)
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment