From 9892866d196bb15b75e1ee2b9f005b21d574bed2 Mon Sep 17 00:00:00 2001 From: pfdietz <pfdietz@localhost> Date: Thu, 7 Oct 2004 01:14:06 +0000 Subject: [PATCH] Add some checks for logical pathnames to rename-file, delete-file tests. Add more tests for with-output-to-string for base-char element type. --- ansi-tests/delete-file.lsp | 2 ++ ansi-tests/rename-file.lsp | 2 ++ ansi-tests/with-output-to-string.lsp | 24 +++++++++++++++++++++--- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/ansi-tests/delete-file.lsp b/ansi-tests/delete-file.lsp index ab6a529e..fef9bf01 100644 --- a/ansi-tests/delete-file.lsp +++ b/ansi-tests/delete-file.lsp @@ -29,6 +29,7 @@ (deftest delete-file.3 (let ((pn "CLTEST:scratchfile.txt")) + (assert (typep (pathname pn) 'logical-pathname)) (unless (probe-file pn) (with-open-file (s pn :direction :output) (format s "Contents~%"))) @@ -40,6 +41,7 @@ (deftest delete-file.4 (let ((pn "CLTEST:scratchfile.txt")) + (assert (typep (pathname pn) 'logical-pathname)) (unless (probe-file pn) (with-open-file (s pn :direction :output) (format s "Contents~%"))) diff --git a/ansi-tests/rename-file.lsp b/ansi-tests/rename-file.lsp index 3c55dd78..906cba07 100644 --- a/ansi-tests/rename-file.lsp +++ b/ansi-tests/rename-file.lsp @@ -111,6 +111,8 @@ (pn2 "CLTEST:file-that-was-renamed.txt")) (delete-all-versions pn1) (delete-all-versions pn2) + (assert (typep (pathname pn1) 'logical-pathname)) + (assert (typep (pathname pn2) 'logical-pathname)) (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) diff --git a/ansi-tests/with-output-to-string.lsp b/ansi-tests/with-output-to-string.lsp index 23a40c43..d3b96e48 100644 --- a/ansi-tests/with-output-to-string.lsp +++ b/ansi-tests/with-output-to-string.lsp @@ -45,8 +45,10 @@ "&") (deftest with-output-to-string.8 - (with-output-to-string (s nil :element-type 'base-char) - (write-char #\8 s)) + (let ((str (with-output-to-string (s nil :element-type 'base-char) + (write-char #\8 s)))) + (assert (typep str 'simple-base-string)) + str) "8") (deftest with-output-to-string.9 @@ -88,4 +90,20 @@ (write-char #\9 s)) "049") - +(deftest with-output-to-string.14 + (let* ((str1 (make-array '(256) :element-type 'base-char :fill-pointer 0)) + (str2 (with-output-to-string + (s nil :element-type 'base-char) + (loop for i below 256 + for c = (code-char i) + when (typep c 'base-char) + do (write-char c s) + do (vector-push c str1))))) + (if (string= str1 str2) :good + (list str1 str2))) + :good) + + + + + \ No newline at end of file -- GitLab