X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=tests%2Fseq.impure.lisp;h=7de07561da366d526d0455b0c0e998c7c0a6ae27;hb=f3491f128307938cc56367f739b8fbf9e5d503b6;hp=ffb1ec7d1b5b1830044f401c403f830ef22d6979;hpb=13fb19c3183a0effb7c35a2d453d6c6c91726e26;p=sbcl.git diff --git a/tests/seq.impure.lisp b/tests/seq.impure.lisp index ffb1ec7..7de0756 100644 --- a/tests/seq.impure.lisp +++ b/tests/seq.impure.lisp @@ -1118,4 +1118,25 @@ (error () :error)))))) +;;; tests of deftype types equivalent to STRING or SIMPLE-STRING +(deftype %string () 'string) +(deftype %simple-string () 'simple-string) +(deftype string-3 () '(string 3)) +(deftype simple-string-3 () '(simple-string 3)) + +(with-test (:name :user-defined-string-types-map-etc) + (dolist (type '(%string %simple-string string-3 simple-string-3)) + (assert (string= "foo" (coerce '(#\f #\o #\o) type))) + (assert (string= "foo" (map type 'identity #(#\f #\o #\o)))) + (assert (string= "foo" (merge type '(#\o) '(#\f #\o) 'char<))) + (assert (string= "foo" (concatenate type '(#\f) "oo"))) + (assert (string= "ooo" (make-sequence type 3 :initial-element #\o))))) +(with-test (:name :user-defined-string-types-map-etc-error) + (dolist (type '(string-3 simple-string-3)) + (assert (raises-error? (coerce '(#\q #\u #\u #\x) type))) + (assert (raises-error? (map type 'identity #(#\q #\u #\u #\x)))) + (assert (raises-error? (merge type '(#\q #\x) "uu" 'char<))) + (assert (raises-error? (concatenate type "qu" '(#\u #\x)))) + (assert (raises-error? (make-sequence type 4 :initial-element #\u))))) + ;;; success