summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJustus Winter <justus@g10code.com>2016-12-08 15:39:05 +0100
committerJustus Winter <justus@g10code.com>2016-12-08 15:39:05 +0100
commita2bedc8ac6fcdcd1de0a9fa3d540006481387dff (patch)
tree46d4c3f7206b8c6da52ee5a8de3b454d7b37cc62 /tests
parentg10: Fix out-of-bounds access. (diff)
downloadgnupg2-a2bedc8ac6fcdcd1de0a9fa3d540006481387dff.tar.xz
gnupg2-a2bedc8ac6fcdcd1de0a9fa3d540006481387dff.zip
gpgscm: Generalize 'for-each-p'.
* tests/gpgscm/tests.scm (for-each-p): Generalize to N lists like for-each. (for-each-p'): Likewise. Signed-off-by: Justus Winter <justus@g10code.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/gpgscm/tests.scm15
1 files changed, 8 insertions, 7 deletions
diff --git a/tests/gpgscm/tests.scm b/tests/gpgscm/tests.scm
index e2b38f5c7..bd51819d2 100644
--- a/tests/gpgscm/tests.scm
+++ b/tests/gpgscm/tests.scm
@@ -77,17 +77,18 @@
(flush-stdio)))
(set! *progress-nesting* (- *progress-nesting* 1)))
-(define (for-each-p msg proc lst)
- (for-each-p' msg proc (lambda (x) x) lst))
+(define (for-each-p msg proc lst . lsts)
+ (apply for-each-p' `(,msg ,proc ,(lambda (x . xs) x) ,lst ,@lsts)))
-(define (for-each-p' msg proc fmt lst)
+(define (for-each-p' msg proc fmt lst . lsts)
(call-with-progress
msg
(lambda (progress)
- (for-each (lambda (a)
- (progress (fmt a))
- (proc a))
- lst))))
+ (apply for-each
+ `(,(lambda args
+ (progress (apply fmt args))
+ (apply proc args))
+ ,lst ,@lsts)))))
;; Process management.
(define CLOSED_FD -1)