From 1f76f8d8bc65fad98927c977baf4d5e36dafe52b Mon Sep 17 00:00:00 2001 From: Justus Winter Date: Fri, 7 Oct 2016 16:16:15 +0200 Subject: 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 --- tests/gpgscm/lib.scm | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tests/gpgscm/lib.scm') 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) -- cgit v1.2.3