X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests%2Fstring.pure.lisp;h=89e98066c94daf1cff3700ee4f4f748d5a1e4b0e;hb=d7875c296a4988e9f27e2776237884deb1984c62;hp=cd96fb1ef938d68ec629fb26e0d83d7dec97d9d7;hpb=2d9524f6c89f3cf6794b5bd262778fff856a7777;p=sbcl.git diff --git a/tests/string.pure.lisp b/tests/string.pure.lisp index cd96fb1..89e9806 100644 --- a/tests/string.pure.lisp +++ b/tests/string.pure.lisp @@ -127,3 +127,21 @@ (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) +