1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-03 22:56:33 +02:00

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 <justus@g10code.com>
This commit is contained in:
Justus Winter 2016-10-07 16:16:15 +02:00
parent 11eac7eb2f
commit 1f76f8d8bc
5 changed files with 17 additions and 8 deletions

View file

@ -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)