(string-append/shared): New tests.
authorKevin Ryde <user42@zip.com.au>
Wed, 30 Nov 2005 00:35:45 +0000 (00:35 +0000)
committerKevin Ryde <user42@zip.com.au>
Wed, 30 Nov 2005 00:35:45 +0000 (00:35 +0000)
test-suite/tests/srfi-13.test

index f0dd00f..b135434 100644 (file)
     (pass-if "more than one match, start and end index"
       (string-any char-upper-case? "abCDE" 1 4))))
 
     (pass-if "more than one match, start and end index"
       (string-any char-upper-case? "abCDE" 1 4))))
 
+;;;
+;;; string-append/shared
+;;;
+
+(with-test-prefix "string-append/shared"
+
+  (pass-if "no args"
+    (string=? "" (string-append/shared)))
+
+  (with-test-prefix "one arg"
+    (pass-if "empty"
+      (string=? "" (string-append/shared "")))
+    (pass-if "non-empty"
+      (string=? "xyz" (string-append/shared "xyz"))))
+
+  (with-test-prefix "two args"
+    (pass-if (string=? ""       (string-append/shared ""    "")))
+    (pass-if (string=? "xyz"    (string-append/shared "xyz" "")))
+    (pass-if (string=? "xyz"    (string-append/shared ""    "xyz")))
+    (pass-if (string=? "abcxyz" (string-append/shared "abc" "xyz"))))
+
+  (with-test-prefix "three args"
+    (pass-if (string=? ""      (string-append/shared ""   ""   "")))
+    (pass-if (string=? "xy"    (string-append/shared "xy" ""   "")))
+    (pass-if (string=? "xy"    (string-append/shared ""   "xy" "")))
+    (pass-if (string=? "abxy"   (string-append/shared "ab" "xy" "")))
+    (pass-if (string=? "ab"     (string-append/shared ""   ""   "ab")))
+    (pass-if (string=? "xyab"   (string-append/shared "xy" ""   "ab")))
+    (pass-if (string=? "xyab"   (string-append/shared ""   "xy" "ab")))
+    (pass-if (string=? "ghxyab" (string-append/shared "gh" "xy" "ab"))))
+
+  (with-test-prefix "four args"
+    (pass-if (string=? ""      (string-append/shared ""   ""   ""   "")))
+    (pass-if (string=? "xy"    (string-append/shared "xy" ""   ""   "")))
+    (pass-if (string=? "xy"    (string-append/shared ""   "xy" ""   "")))
+    (pass-if (string=? "xy"    (string-append/shared ""   ""   "xy" "")))
+    (pass-if (string=? "xy"    (string-append/shared ""   ""   ""   "xy")))
+
+    (pass-if (string=? "abxy"   (string-append/shared "ab" "xy" ""   "")))
+    (pass-if (string=? "abxy"   (string-append/shared "ab" ""   "xy" "")))
+    (pass-if (string=? "abxy"   (string-append/shared "ab" ""   ""   "xy")))
+    (pass-if (string=? "abxy"   (string-append/shared ""   "ab" ""   "xy")))
+    (pass-if (string=? "abxy"   (string-append/shared ""   ""   "ab" "xy")))))
+
 ;;;
 ;;; string-concatenate
 ;;;
 ;;;
 ;;; string-concatenate
 ;;;