0.8.2.7:
[sbcl.git] / tests / pathnames.impure.lisp
index 00da4c0..f939a49 100644 (file)
@@ -14,9 +14,8 @@
 ;;;; absolutely no warranty. See the COPYING and CREDITS files for
 ;;;; more information.
 
-(in-package "CL-USER")
-
 (load "assertoid.lisp")
+(use-package "ASSERTOID")
 
 (setf (logical-pathname-translations "demo0")
       '(("**;*.*.*" "/tmp/")))
@@ -25,7 +24,7 @@
 ;;; CL:PARSE-ERROR (or more specifically, of type
 ;;; SB-KERNEL:NAMESTRING-PARSE-ERROR).
 (assert
-  (typep (grab-condition (translate-logical-pathname "demo0::bla;file.lisp"))
+  (typep (grab-condition (logical-pathname "demo0::bla;file.lisp"))
          'parse-error))
 
 ;;; some things SBCL-0.6.9 used not to parse correctly:
 ;;; FIXME: currently SBCL throws NAMESTRING-PARSE-ERROR: should this be
 ;;; a TYPE-ERROR?
 
-(assert (not (ignore-errors
-               (make-pathname :host "FOO" :directory "!bla" :name "bar"))))
-
-;; error: name-component not valid
-(assert (not (ignore-errors
-               (make-pathname :host "FOO" :directory "bla" :name "!bar"))))
-
-;; error: type-component not valid.
-(assert (not (ignore-errors
-               (make-pathname :host "FOO" :directory "bla" :name "bar"
-                              :type "&baz"))))
+(locally
+  ;; MAKE-PATHNAME is UNSAFELY-FLUSHABLE
+  (declare (optimize safety))
+  
+  (assert (not (ignore-errors
+               (make-pathname :host "FOO" :directory "!bla" :name "bar"))))
+  
+  ;; error: name-component not valid
+  (assert (not (ignore-errors
+               (make-pathname :host "FOO" :directory "bla" :name "!bar"))))
+  
+  ;; error: type-component not valid.
+  (assert (not (ignore-errors
+               (make-pathname :host "FOO" :directory "bla" :name "bar"
+                              :type "&baz")))))
 
 ;;; We may need to parse the host as a LOGICAL-NAMESTRING HOST. The
 ;;; HOST in PARSE-NAMESTRING can be either a string or :UNSPECIFIC
         (setf (logical-pathname-translations "")
               (list '("**;*.*.*" "/**/*.*")))))
 \f
+;;; Bug 200: translate-logical-pathname is according to the spec supposed
+;;; not to give errors if asked to translate a namestring for a valid
+;;; physical pathname.  Failed in 0.7.7.28 and before
+(assert (string= (namestring (translate-logical-pathname "/")) "/"))
+
+\f
+;;; Not strictly pathname logic testing, but until sbcl-0.7.6.19 we
+;;; had difficulty with non-FILE-STREAM stream arguments to pathname
+;;; functions (they would cause memory protection errors).  Make sure
+;;; that those errors are gone:
+(assert (raises-error? (pathname (make-string-input-stream "FOO"))
+                      type-error))
+(assert (raises-error? (merge-pathnames (make-string-output-stream))
+                      type-error))
+\f
 ;;;; success
 (quit :unix-status 104)