summaryrefslogtreecommitdiff
path: root/test-suite/tests/strings.test
diff options
context:
space:
mode:
authorMark H Weaver <mhw@netris.org>2012-10-30 23:46:31 -0400
committerMark H Weaver <mhw@netris.org>2012-10-30 23:46:31 -0400
commitfa980bcc0f5b186b98d84fc5d165d35fcbb5d5ec (patch)
tree411ee841f7526fe7138e42cf399911518df06309 /test-suite/tests/strings.test
parente088b09d7dce5d78c96288778969876b6d25d726 (diff)
parent10744b7c5007ccac19ea9654be6e749fe6a60992 (diff)
downloadguile-fa980bcc0f5b186b98d84fc5d165d35fcbb5d5ec.tar.gz
Merge remote-tracking branch 'origin/stable-2.0'
Moved scm_i_struct_hash from struct.c to hash.c and made it static. The port's alist is now a field of 'scm_t_port'. Conflicts: libguile/arrays.c libguile/hash.c libguile/ports.c libguile/print.h libguile/read.c
Diffstat (limited to 'test-suite/tests/strings.test')
-rw-r--r--test-suite/tests/strings.test62
1 files changed, 61 insertions, 1 deletions
diff --git a/test-suite/tests/strings.test b/test-suite/tests/strings.test
index d892b7077..679e17326 100644
--- a/test-suite/tests/strings.test
+++ b/test-suite/tests/strings.test
@@ -557,7 +557,67 @@
(pass-if "char 255"
(equal? '("a" "b")
(string-split (string #\a (integer->char 255) #\b)
- (integer->char 255)))))
+ (integer->char 255))))
+
+ (pass-if "empty string - char"
+ (equal? '("")
+ (string-split "" #\:)))
+
+ (pass-if "non-empty - char - no delimiters"
+ (equal? '("foobarfrob")
+ (string-split "foobarfrob" #\:)))
+
+ (pass-if "non-empty - char - delimiters"
+ (equal? '("foo" "bar" "frob")
+ (string-split "foo:bar:frob" #\:)))
+
+ (pass-if "non-empty - char - leading delimiters"
+ (equal? '("" "" "foo" "bar" "frob")
+ (string-split "::foo:bar:frob" #\:)))
+
+ (pass-if "non-empty - char - trailing delimiters"
+ (equal? '("foo" "bar" "frob" "" "")
+ (string-split "foo:bar:frob::" #\:)))
+
+ (pass-if "empty string - charset"
+ (equal? '("")
+ (string-split "" (char-set #\:))))
+
+ (pass-if "non-empty - charset - no delimiters"
+ (equal? '("foobarfrob")
+ (string-split "foobarfrob" (char-set #\:))))
+
+ (pass-if "non-empty - charset - delimiters"
+ (equal? '("foo" "bar" "frob")
+ (string-split "foo:bar:frob" (char-set #\:))))
+
+ (pass-if "non-empty - charset - leading delimiters"
+ (equal? '("" "" "foo" "bar" "frob")
+ (string-split "::foo:bar:frob" (char-set #\:))))
+
+ (pass-if "non-empty - charset - trailing delimiters"
+ (equal? '("foo" "bar" "frob" "" "")
+ (string-split "foo:bar:frob::" (char-set #\:))))
+
+ (pass-if "empty string - pred"
+ (equal? '("")
+ (string-split "" (negate char-alphabetic?))))
+
+ (pass-if "non-empty - pred - no delimiters"
+ (equal? '("foobarfrob")
+ (string-split "foobarfrob" (negate char-alphabetic?))))
+
+ (pass-if "non-empty - pred - delimiters"
+ (equal? '("foo" "bar" "frob")
+ (string-split "foo:bar:frob" (negate char-alphabetic?))))
+
+ (pass-if "non-empty - pred - leading delimiters"
+ (equal? '("" "" "foo" "bar" "frob")
+ (string-split "::foo:bar:frob" (negate char-alphabetic?))))
+
+ (pass-if "non-empty - pred - trailing delimiters"
+ (equal? '("foo" "bar" "frob" "" "")
+ (string-split "foo:bar:frob::" (negate char-alphabetic?)))))
(with-test-prefix "substring-move!"