diff options
author | Justus Winter <[email protected]> | 2016-10-07 14:16:15 +0000 |
---|---|---|
committer | Justus Winter <[email protected]> | 2016-10-07 14:25:55 +0000 |
commit | 1f76f8d8bc65fad98927c977baf4d5e36dafe52b (patch) | |
tree | 71c2cb8a61d2cb26176518f967a2ed9284eaedb1 /tests/gpgscm/lib.scm | |
parent | gpgscm: Improve test of low-level functions. (diff) | |
download | gnupg-1f76f8d8bc65fad98927c977baf4d5e36dafe52b.tar.gz gnupg-1f76f8d8bc65fad98927c977baf4d5e36dafe52b.zip |
tests: Improve handling of Windows newlines.
* tests/gpgscm/lib.scm (string-split-newlines): New function.
* tests/openpgp/default-key.scm: Use new function.
* tests/openpgp/defs.scm: Likewise.
* tests/openpgp/export.scm: Likewise.
* tests/openpgp/import.scm: Likewise.
Signed-off-by: Justus Winter <[email protected]>
Diffstat (limited to 'tests/gpgscm/lib.scm')
-rw-r--r-- | tests/gpgscm/lib.scm | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/gpgscm/lib.scm b/tests/gpgscm/lib.scm index fe28262dc..e4ab48303 100644 --- a/tests/gpgscm/lib.scm +++ b/tests/gpgscm/lib.scm @@ -92,6 +92,15 @@ (assert (string=? "bar" (cadr (string-split "foo:bar:baz" #\:)))) (assert (string=? "baz" (caddr (string-split "foo:bar:baz" #\:)))) +;; Split haystack at newlines. +(define (string-split-newlines haystack) + (if *win32* + (map (lambda (line) (if (string-suffix? line "\r") + (substring line 0 (- (string-length line) 1)) + line)) + (string-split haystack #\newline)) + (string-split haystack #\newline))) + ;; Trim the prefix of S containing only characters that make PREDICATE ;; true. (define (string-ltrim predicate s) |