aboutsummaryrefslogtreecommitdiffstats
path: root/tests/gpgscm
diff options
context:
space:
mode:
Diffstat (limited to 'tests/gpgscm')
-rw-r--r--tests/gpgscm/lib.scm18
-rw-r--r--tests/gpgscm/tests.scm8
2 files changed, 26 insertions, 0 deletions
diff --git a/tests/gpgscm/lib.scm b/tests/gpgscm/lib.scm
index e4ab48303..316eacf87 100644
--- a/tests/gpgscm/lib.scm
+++ b/tests/gpgscm/lib.scm
@@ -42,6 +42,24 @@
((not (p (car l))) #f)
(else (all p (cdr l)))))
+;; Return the first element of a list.
+(define first car)
+
+;; Return the last element of a list.
+(define (last lst)
+ (if (null? (cdr lst))
+ (car lst)
+ (last (cdr lst))))
+
+;; Compute the powerset of a list.
+(define (powerset set)
+ (if (null? set)
+ '(())
+ (let ((rst (powerset (cdr set))))
+ (append (map (lambda (x) (cons (car set) x))
+ rst)
+ rst))))
+
;; Is PREFIX a prefix of S?
(define (string-prefix? s prefix)
(and (>= (string-length s) (string-length prefix))
diff --git a/tests/gpgscm/tests.scm b/tests/gpgscm/tests.scm
index 8986a705a..d89a96f88 100644
--- a/tests/gpgscm/tests.scm
+++ b/tests/gpgscm/tests.scm
@@ -481,3 +481,11 @@
(catch (list tmpfiles source *error*)
(apply function `(,(call-with-input-file source read-all) ,@args)))
(list tmpfiles source #f)))
+
+;;
+;; Developing and debugging tests.
+;;
+
+;; Spawn an os shell.
+(define (interactive-shell)
+ (call-with-fds `(,(getenv "SHELL")) 0 1 2))