summaryrefslogtreecommitdiffstats
path: root/tests/openpgp/defs.scm
diff options
context:
space:
mode:
authorJustus Winter <justus@g10code.com>2016-06-21 13:20:29 +0200
committerJustus Winter <justus@g10code.com>2016-06-21 16:22:11 +0200
commit0340fcdac864109e3dd6edee759efc96e4d3f84e (patch)
treeceb1d972ba098c15bfbeb1a455002931e84be9e9 /tests/openpgp/defs.scm
parentgpgscm: Improve test framework. (diff)
downloadgnupg2-0340fcdac864109e3dd6edee759efc96e4d3f84e.tar.xz
gnupg2-0340fcdac864109e3dd6edee759efc96e4d3f84e.zip
tests/openpgp: Port the remaining tests to Scheme.
* tests/openpgp/Makefile.am (TESTS): Add new tests. * tests/openpgp/defs.scm (gpg-with-colons): New function. (get-config): Use new function. * tests/openpgp/export.scm: New file. * tests/openpgp/tofu.scm: Likewise. Signed-off-by: Justus Winter <justus@g10code.com>
Diffstat (limited to 'tests/openpgp/defs.scm')
-rw-r--r--tests/openpgp/defs.scm11
1 files changed, 6 insertions, 5 deletions
diff --git a/tests/openpgp/defs.scm b/tests/openpgp/defs.scm
index 6fdb95580..4257b286e 100644
--- a/tests/openpgp/defs.scm
+++ b/tests/openpgp/defs.scm
@@ -82,12 +82,13 @@
(define (pipe:gpg args)
(pipe:spawn `(,@GPG --output - ,@args -)))
+(define (gpg-with-colons args)
+ (let ((s (call-popen `(,@GPG --with-colons ,@args) "")))
+ (map (lambda (line) (string-split line #\:))
+ (string-split s #\newline))))
+
(define (get-config what)
- (let* ((config-string
- (call-popen `(,@GPG --with-colons --list-config ,what) ""))
- (config (string-splitn
- (string-rtrim char-whitespace? config-string) #\: 2)))
- (string-split (caddr config) #\;)))
+ (string-split (caddar (gpg-with-colons `(--list-config ,what))) #\;))
(define all-pubkey-algos (get-config "pubkeyname"))
(define all-hash-algos (get-config "digestname"))