mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-30 16:17:02 +01: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:
parent
11eac7eb2f
commit
1f76f8d8bc
@ -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)
|
||||
|
@ -71,6 +71,6 @@
|
||||
(unless (any (lambda (line)
|
||||
(and (string-prefix? line ":pubkey enc packet:")
|
||||
(string-suffix? line "45117079")))
|
||||
(string-split c #\newline))
|
||||
(string-split-newlines c))
|
||||
(exit 1))))))
|
||||
'("8BC90111" "3E880CFF" "F5F77B83" "45117079" "1EA97479"))
|
||||
|
@ -91,7 +91,7 @@
|
||||
(define (gpg-with-colons args)
|
||||
(let ((s (call-popen `(,@GPG --with-colons ,@args) "")))
|
||||
(map (lambda (line) (string-split line #\:))
|
||||
(string-split s #\newline))))
|
||||
(string-split-newlines s))))
|
||||
|
||||
(define (get-config what)
|
||||
(string-split (caddar (gpg-with-colons `(--list-config ,what))) #\;))
|
||||
@ -133,8 +133,8 @@
|
||||
(lambda (line)
|
||||
(let ((p (string-split line #\:)))
|
||||
(list (string->number (cadr p)) (caddr p))))
|
||||
(string-split
|
||||
(call-popen `(,@GPG --with-colons ,@args) input) #\newline)))
|
||||
(string-split-newlines
|
||||
(call-popen `(,@GPG --with-colons ,@args) input))))
|
||||
|
||||
;; Dearmor a file.
|
||||
(define (dearmor source-name sink-name)
|
||||
|
@ -37,13 +37,13 @@
|
||||
"Signature packet not found"))
|
||||
|
||||
(define (check-exported-public-key packet-dump keyid)
|
||||
(let ((dump (string-split packet-dump #\newline)))
|
||||
(let ((dump (string-split-newlines packet-dump)))
|
||||
(check-for (lambda (l) (string-prefix? l ":public key packet:")) dump
|
||||
"Public key packet not found")
|
||||
(check-exported-key dump keyid)))
|
||||
|
||||
(define (check-exported-private-key packet-dump keyid)
|
||||
(let ((dump (string-split packet-dump #\newline)))
|
||||
(let ((dump (string-split-newlines packet-dump)))
|
||||
(check-for (lambda (l) (string-prefix? l ":secret key packet:")) dump
|
||||
"Secret key packet not found")
|
||||
(check-exported-key dump keyid)))
|
||||
|
@ -36,7 +36,7 @@
|
||||
(unless (any (lambda (line)
|
||||
(and (string-prefix? line "rvk:")
|
||||
(string-contains? line ":0EE5BE979282D80B9F7540F1CCD2ED94D21739E9:")))
|
||||
(string-split c #\newline))
|
||||
(string-split-newlines c))
|
||||
(exit 1)))))
|
||||
|
||||
(define fpr1 "9E669861368BCA0BE42DAF7DDDA252EBB8EBE1AF")
|
||||
@ -55,6 +55,6 @@
|
||||
(lambda (line)
|
||||
(and (string-prefix? line "pub:")
|
||||
(string-contains? line ":4096:1:DDA252EBB8EBE1AF:")))
|
||||
(string-split c #\newline))))
|
||||
(string-split-newlines c))))
|
||||
(unless (= 2 (length keys))
|
||||
(error "Importing keys with long id collision failed"))))))
|
||||
|
Loading…
x
Reference in New Issue
Block a user