Fix make-array transforms.
[sbcl.git] / tests / string.pure.lisp
index cd96fb1..89e9806 100644 (file)
   (assert (equal "abcdaba" s))
   (assert (equal "cdaba" s2))
   (assert (equal "abcd" s3)))
+
+;;; Trimming should replace displacement offsets
+(let* ((etype 'base-char)
+             (s0
+              (make-array '(6) :initial-contents "abcaeb" :element-type etype))
+             (s
+              (make-array '(3) :element-type etype :displaced-to s0 :displaced-index-offset 1)))
+  (assert (equal "bc" (string-right-trim "ab" s)))
+  (assert (equal "bca" s))
+  (assert (equal "abcaeb" s0)))
+
+;;; Trimming non-simple-strings when there is nothing to do
+(let ((a (make-array 10 :element-type 'character :initial-contents "abcde00000" :fill-pointer 5)))
+  (assert (equal "abcde" (string-right-trim "Z" a))))
+
+;;; Trimming non-strings when there is nothing to do.
+(string-right-trim " " #\a)
+