diff options
author | Justus Winter <[email protected]> | 2017-07-14 10:57:41 +0000 |
---|---|---|
committer | Justus Winter <[email protected]> | 2017-07-14 10:57:41 +0000 |
commit | b4d25082fd4502ec01d511c22fecd60d513b81f4 (patch) | |
tree | b315541267df319b00ecc56e5322adf1f309c471 /tests/gpgscm/repl.scm | |
parent | gpgscm: Fail early if the test setup fails. (diff) | |
download | gnupg-b4d25082fd4502ec01d511c22fecd60d513b81f4.tar.gz gnupg-b4d25082fd4502ec01d511c22fecd60d513b81f4.zip |
gpgscm: Library improvements.
* tests/gpgscm/repl.scm (prompt-yes-no?): New function.
* tests/gpgscm/tests.scm (pathsep-split): Likewise.
(pathsep-join): Likewise.
(with-path): Use the new function.
Signed-off-by: Justus Winter <[email protected]>
Diffstat (limited to '')
-rw-r--r-- | tests/gpgscm/repl.scm | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/gpgscm/repl.scm b/tests/gpgscm/repl.scm index 84454dc7c..833ec0dec 100644 --- a/tests/gpgscm/repl.scm +++ b/tests/gpgscm/repl.scm @@ -55,3 +55,15 @@ (define (interactive-repl . environment) (repl (lambda (p) (prompt-append-prefix "gpgscm " p)) (if (null? environment) (interaction-environment) (car environment)))) + +;; Ask a yes/no question. +(define (prompt-yes-no? question default) + (let ((answer (prompt (string-append question "? [" + (if default "Y/n" "y/N") "] ")))) + (cond + ((= 0 (string-length answer)) + default) + ((or (equal? "y" answer) (equal? "Y" answer)) + #t) + (else + #f)))) |