(test (string= (string-capitalize "pipe 13a, foo16c") "Pipe 13a, Foo16c"))
(test (string= (string-capitalize "a fool" :start 2 :end nil) "a Fool"))
-;; JSCL: no COPY-SEQ yet
-;; (test (let ((str (copy-seq "0123ABCD890a")))
-;; (and (string= (nstring-downcase str :start 5 :end 7) "0123AbcD890a")
-;; (string= str "0123AbcD890a"))))
-
-;; (test (let* ((str0 (copy-seq "abcde"))
-;; (str (nstring-upcase str0)))
-;; (and (eq str0 str)
-;; (string= str "ABCDE"))))
-;; (test (let* ((str0 (copy-seq "Dr. Livingston, I presume?"))
-;; (str (nstring-upcase str0)))
-;; (and (eq str0 str)
-;; (string= str "DR. LIVINGSTON, I PRESUME?"))))
-;; (test (let* ((str0 (copy-seq "Dr. Livingston, I presume?"))
-;; (str (nstring-upcase str0 :start 6 :end 10)))
-;; (and (eq str0 str)
-;; (string= str "Dr. LiVINGston, I presume?"))))
-
-;; (test (let* ((str0 (copy-seq "abcde"))
-;; (str (nstring-upcase str0 :start 2 :end nil)))
-;; (string= str "abCDE")))
-
-
-
-;; (test (let* ((str0 (copy-seq "Dr. Livingston, I presume?"))
-;; (str (nstring-downcase str0)))
-;; (and (eq str0 str)
-;; (string= str "dr. livingston, i presume?"))))
-;; (test (let* ((str0 (copy-seq "ABCDE"))
-;; (str (nstring-downcase str0 :start 2 :end nil)))
-;; (string= str "ABcde")))
-
-;; (test (let* ((str0 (copy-seq "elm 13c arthur;fig don't"))
-;; (str (nstring-capitalize str0)))
-;; (and (eq str0 str)
-;; (string= str "Elm 13c Arthur;Fig Don'T"))))
-
-;; (test (let* ((str0 (copy-seq " hello "))
-;; (str (nstring-capitalize str0)))
-;; (and (eq str0 str)
-;; (string= str " Hello "))))
-;; (test (let* ((str0 (copy-seq
-;; "occlUDeD cASEmenTs FOreSTAll iNADVertent DEFenestraTION"))
-;; (str (nstring-capitalize str0)))
-;; (and (eq str0 str)
-;; (string= str
-;; "Occluded Casements Forestall Inadvertent Defenestration"))))
-;; (test (let* ((str0 (copy-seq "DON'T!"))
-;; (str (nstring-capitalize str0)))
-;; (and (eq str0 str)
-;; (string= str "Don'T!")))) ;not "Don't!"
-;; (test (let* ((str0 (copy-seq "pipe 13a, foo16c"))
-;; (str (nstring-capitalize str0)))
-;; (and (eq str0 str)
-;; (string= str "Pipe 13a, Foo16c"))))
-;; (test (let* ((str0 (copy-seq "a fool"))
-;; (str (nstring-capitalize str0 :start 2 :end nil)))
-;; (string= str "a Fool")))
-
-
-
-;; JSCL: my implementation of these needs :FROM-END, which doesn't exist yet.
-;; (test (string= (string-trim "abc" "abcaakaaakabcaaa") "kaaak"))
+;; JSCL HACK: a simple COPY-SEQ for testing string functions, since we don't have a real one yet
+(defun copy-seq (string)
+ (let ((copy (make-string (length string))))
+ (dotimes (i (length string) copy)
+ (aset copy i (char string i)))))
+
+(test (let ((str (copy-seq "0123ABCD890a")))
+ (and (string= (nstring-downcase str :start 5 :end 7) "0123AbcD890a")
+ (string= str "0123AbcD890a"))))
+
+(test (let* ((str0 (copy-seq "abcde"))
+ (str (nstring-upcase str0)))
+ (and (eq str0 str)
+ (string= str "ABCDE"))))
+(test (let* ((str0 (copy-seq "Dr. Livingston, I presume?"))
+ (str (nstring-upcase str0)))
+ (and (eq str0 str)
+ (string= str "DR. LIVINGSTON, I PRESUME?"))))
+(test (let* ((str0 (copy-seq "Dr. Livingston, I presume?"))
+ (str (nstring-upcase str0 :start 6 :end 10)))
+ (and (eq str0 str)
+ (string= str "Dr. LiVINGston, I presume?"))))
+
+(test (let* ((str0 (copy-seq "abcde"))
+ (str (nstring-upcase str0 :start 2 :end nil)))
+ (string= str "abCDE")))
+
+
+
+(test (let* ((str0 (copy-seq "Dr. Livingston, I presume?"))
+ (str (nstring-downcase str0)))
+ (and (eq str0 str)
+ (string= str "dr. livingston, i presume?"))))
+(test (let* ((str0 (copy-seq "ABCDE"))
+ (str (nstring-downcase str0 :start 2 :end nil)))
+ (string= str "ABcde")))
+
+(test (let* ((str0 (copy-seq "elm 13c arthur;fig don't"))
+ (str (nstring-capitalize str0)))
+ (and (eq str0 str)
+ (string= str "Elm 13c Arthur;Fig Don'T"))))
+
+(test (let* ((str0 (copy-seq " hello "))
+ (str (nstring-capitalize str0)))
+ (and (eq str0 str)
+ (string= str " Hello "))))
+(test (let* ((str0 (copy-seq
+ "occlUDeD cASEmenTs FOreSTAll iNADVertent DEFenestraTION"))
+ (str (nstring-capitalize str0)))
+ (and (eq str0 str)
+ (string= str
+ "Occluded Casements Forestall Inadvertent Defenestration"))))
+(test (let* ((str0 (copy-seq "DON'T!"))
+ (str (nstring-capitalize str0)))
+ (and (eq str0 str)
+ (string= str "Don'T!")))) ;not "Don't!"
+(test (let* ((str0 (copy-seq "pipe 13a, foo16c"))
+ (str (nstring-capitalize str0)))
+ (and (eq str0 str)
+ (string= str "Pipe 13a, Foo16c"))))
+(test (let* ((str0 (copy-seq "a fool"))
+ (str (nstring-capitalize str0 :start 2 :end nil)))
+ (string= str "a Fool")))
+
+
+
+(test (string= (string-trim "abc" "abcaakaaakabcaaa") "kaaak"))
;; (test (string= (string-trim '(#\Space #\Tab #\Newline) " garbanzo beans
;; ") "garbanzo beans"))
-;; (test (string= (string-trim " (*)" " ( *three (silly) words* ) ")
-;; "three (silly) words"))
-;; (test (string= (string-left-trim "abc" "labcabcabc") "labcabcabc"))
-;; (test (string= (string-left-trim " (*)" " ( *three (silly) words* ) ")
-;; "three (silly) words* ) "))
-;; (test (string= (string-right-trim " (*)" " ( *three (silly) words* ) ")
-;; " ( *three (silly) words"))
-;; (test (string= (string-trim "ABC" "abc") "abc"))
-;; (test (string= (string-trim "AABBCC" "abc") "abc"))
-;; (test (string= (string-trim "" "abc") "abc"))
-;; (test (string= (string-trim "ABC" "") ""))
-;; (test (string= (string-trim "cba" "abc") ""))
-;; (test (string= (string-trim "cba" "abccba") ""))
-;; (test (string= (string-trim "ccbbba" "abccba") ""))
-;; (test (string= (string-trim "cba" "abcxabc") "x"))
-;; (test (string= (string-trim "xyz" "xxyabcxyyz") "abc"))
-;; (test (string= (string-trim "CBA" 'abcxabc) "X"))
-;; (test (string= (string-trim "a" #\a) ""))
+(test (string= (string-trim " (*)" " ( *three (silly) words* ) ")
+ "three (silly) words"))
+(test (string= (string-left-trim "abc" "labcabcabc") "labcabcabc"))
+(test (string= (string-left-trim " (*)" " ( *three (silly) words* ) ")
+ "three (silly) words* ) "))
+(test (string= (string-right-trim " (*)" " ( *three (silly) words* ) ")
+ " ( *three (silly) words"))
+(test (string= (string-trim "ABC" "abc") "abc"))
+(test (string= (string-trim "AABBCC" "abc") "abc"))
+(test (string= (string-trim "" "abc") "abc"))
+(test (string= (string-trim "ABC" "") ""))
+(test (string= (string-trim "cba" "abc") ""))
+(test (string= (string-trim "cba" "abccba") ""))
+(test (string= (string-trim "ccbbba" "abccba") ""))
+(test (string= (string-trim "cba" "abcxabc") "x"))
+(test (string= (string-trim "xyz" "xxyabcxyyz") "abc"))
+(test (string= (string-trim "CBA" 'abcxabc) "X"))
+(test (string= (string-trim "a" #\a) ""))
(test (string= (string-left-trim "ABC" "abc") "abc"))
(test (string= (string-left-trim "CBA" 'abcxabc) "XABC"))
(test (string= (string-left-trim "a" #\a) ""))
-;; (test (string= (string-right-trim "ABC" "abc") "abc"))
-;; (test (string= (string-right-trim "" "abc") "abc"))
-;; (test (string= (string-right-trim "ABC" "") ""))
-;; (test (string= (string-right-trim "cba" "abc") ""))
-;; (test (string= (string-right-trim "cba" "abccba") ""))
-;; (test (string= (string-right-trim "cba" "abcxabc") "abcx"))
-;; (test (string= (string-right-trim "xyz" "xxyabcxyz") "xxyabc"))
-;; (test (string= (string-right-trim "CBA" 'abcxabc) "ABCX"))
-;; (test (string= (string-right-trim "a" #\a) ""))
+(test (string= (string-right-trim "ABC" "abc") "abc"))
+(test (string= (string-right-trim "" "abc") "abc"))
+(test (string= (string-right-trim "ABC" "") ""))
+(test (string= (string-right-trim "cba" "abc") ""))
+(test (string= (string-right-trim "cba" "abccba") ""))
+(test (string= (string-right-trim "cba" "abcxabc") "abcx"))
+(test (string= (string-right-trim "xyz" "xxyabcxyz") "xxyabc"))
+(test (string= (string-right-trim "CBA" 'abcxabc) "ABCX"))
+(test (string= (string-right-trim "a" #\a) ""))