diff options
author | Michael Gran <spk121@yahoo.com> | 2009-09-20 20:58:08 -0700 |
---|---|---|
committer | Michael Gran <spk121@yahoo.com> | 2009-09-20 20:59:44 -0700 |
commit | fee95176df1686b9844cd53dc703f0d5a549bb34 (patch) | |
tree | d595f58c49554dedcf3ffd278a42bf5c0a07ee39 /test-suite/tests/strings.test | |
parent | e5f5113c21f396705d7479a570c96690135c9d36 (diff) | |
download | guile-fee95176df1686b9844cd53dc703f0d5a549bb34.tar.gz |
More tests for strings
* test-suite/tests/vectors.test: test make-vector and interactions between
strings and vectors
* test-suite/tests/strings.test: test string-null?, string? and backslash
escapes
* test-suite/tests/srfi-13.test: test null input strings in string-any and
string-every
Diffstat (limited to 'test-suite/tests/strings.test')
-rw-r--r-- | test-suite/tests/strings.test | 41 |
1 files changed, 39 insertions, 2 deletions
diff --git a/test-suite/tests/strings.test b/test-suite/tests/strings.test index c78fe55ff..013c1a863 100644 --- a/test-suite/tests/strings.test +++ b/test-suite/tests/strings.test @@ -177,7 +177,7 @@ (let ((s "\U000040")) (not (assq-ref (%string-dump s) 'stringbuf-wide)))))) -(with-test-prefix "hex escapes" +(with-test-prefix "escapes" (pass-if-exception "non-hex char in two-digit hex-escape" exception:illegal-escape @@ -216,7 +216,44 @@ (integer->char #x010300))) (pass-if "escaped characters match non-escaped ASCII characters" - (string=? "ABC" "\x41\u0042\U000043"))) + (string=? "ABC" "\x41\u0042\U000043")) + + (pass-if "R5RS backslash escapes" + (string=? "\"\\" (string #\" #\\))) + + (pass-if "Guile extensions backslash escapes" + (string=? "\0\a\f\n\r\t\v" + (apply string (map integer->char '(0 7 12 10 13 9 11)))))) + +;; +;; string? +;; +(with-test-prefix "string?" + + (pass-if "string" + (string? "abc")) + + (pass-if "symbol" + (not (string? 'abc)))) + +;; +;; string-null? +;; + +(with-test-prefix "string-null?" + + (pass-if "null string" + (string-null? "")) + + (pass-if "non-null string" + (not (string-null? "a"))) + + (pass-if "respects \\0" + (not (string-null? "\0"))) + + (pass-if-exception "symbol" + exception:wrong-type-arg + (string-null? 'a))) ;; ;; string=? |