2
;;;; Author: Paul Dietz
3
;;;; Created: Fri Oct 4 04:57:41 2002
4
;;;; Contains: Tests for STRING-LEFT-TRIM
8
(deftest string-left-trim.1
9
(let* ((s (copy-seq "abcdaba"))
10
(s2 (string-left-trim "ab" s)))
15
(deftest string-left-trim.2
16
(let* ((s (copy-seq "abcdaba"))
17
(s2 (string-left-trim '(#\a #\b) s)))
22
(deftest string-left-trim.3
23
(let* ((s (copy-seq "abcdaba"))
24
(s2 (string-left-trim #(#\a #\b) s)))
29
(deftest string-left-trim.4
30
(let* ((s (copy-seq "abcdaba"))
31
(s2 (string-left-trim (make-array 2 :initial-contents '(#\a #\b))
37
(deftest string-left-trim.5
38
(let* ((s (copy-seq "abcdaba"))
39
(s2 (string-left-trim (make-array 2 :initial-contents '(#\a #\b)
40
:element-type 'character)
46
(deftest string-left-trim.6
47
(let* ((s (copy-seq "abcdaba"))
48
(s2 (string-left-trim (make-array 2 :initial-contents '(#\a #\b)
49
:element-type 'standard-char)
55
(deftest string-left-trim.7
56
(let* ((s (copy-seq "abcdaba"))
57
(s2 (string-left-trim (make-array 2 :initial-contents '(#\a #\b)
58
:element-type 'base-char)
64
(deftest string-left-trim.8
65
(let* ((s (copy-seq "abcdaba"))
66
(s2 (string-left-trim (make-array 4 :initial-contents '(#\a #\b #\c #\d)
67
:element-type 'character
74
(deftest string-left-trim.9
75
(let* ((s (make-array 7 :initial-contents "abcdaba"
76
:element-type 'character
78
(s2 (string-left-trim "ab" s)))
83
(deftest string-left-trim.10
84
(let* ((s (make-array 9 :initial-contents "abcdabadd"
85
:element-type 'character
87
(s2 (string-left-trim "ab" s)))
92
(deftest string-left-trim.11
93
(let* ((s (make-array 7 :initial-contents "abcdaba"
94
:element-type 'standard-char
96
(s2 (string-left-trim "ab" s)))
101
(deftest string-left-trim.12
102
(let* ((s (make-array 7 :initial-contents "abcdaba"
103
:element-type 'base-char
105
(s2 (string-left-trim "ab" s)))
110
;;; Test that trimming is case sensitive
111
(deftest string-left-trim.13
112
(let* ((s (copy-seq "aA"))
113
(s2 (string-left-trim "a" s)))
117
(deftest string-left-trim.14
118
(let* ((s '|abcdaba|)
119
(s2 (string-left-trim "ab" s)))
120
(values (symbol-name s) s2))
124
(deftest string-left-trim.15
125
(string-left-trim "abc" "")
128
(deftest string-left-trim.16
129
(string-left-trim "a" #\a)
132
(deftest string-left-trim.17
133
(string-left-trim "b" #\a)
136
(deftest string-left-trim.18
137
(string-left-trim "" (copy-seq "abcde"))
140
(deftest string-left-trim.19
141
(string-left-trim "abc" (copy-seq "abcabcabc"))
144
(deftest string-left-trim.20
145
:notes (:nil-vectors-are-strings)
146
(string-left-trim "abcd" (make-array '(0) :element-type nil))
149
(deftest string-left-trim.21
150
:notes (:nil-vectors-are-strings)
151
(string-left-trim (make-array '(0) :element-type nil) "abcd")
154
(deftest string-left-trim.order.1
157
(string-left-trim (progn (setf x (incf i)) " ")
158
(progn (setf y (incf i))
159
(copy-seq " abc d e f ")))
165
(deftest string-left-trim.error.1
166
(signals-error (string-left-trim) program-error)
169
(deftest string-left-trim.error.2
170
(signals-error (string-left-trim "abc") program-error)
173
(deftest string-left-trim.error.3
174
(signals-error (string-left-trim "abc" "abcdddabc" nil) program-error)