aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorFredrik Salomonsson <plattfot@gmail.com>2020-06-14 16:05:00 -0700
committerFredrik Salomonsson <plattfot@gmail.com>2020-06-14 16:05:00 -0700
commit0514db6bd62d1f3873081b1425aae17f04b37c11 (patch)
tree55054b4dff1ffa1f238a77f9a93a8d1785eb69de /tests
parente10593e3e79f98c33070a31a6e005fba59fd2661 (diff)
downloadpinentry-rofi-0514db6bd62d1f3873081b1425aae17f04b37c11.tar.gz
Update tests to send in the fake-port via the keyword
Instead of using with-output-to-port procedure. As that had some issues with guile-hall, as well as reporting the error from the test suite. As it was accedentally capturing it.
Diffstat (limited to 'tests')
-rwxr-xr-xtests/pinentry-rofi.scm194
1 files changed, 88 insertions, 106 deletions
diff --git a/tests/pinentry-rofi.scm b/tests/pinentry-rofi.scm
index 928fcce..31cbfa3 100755
--- a/tests/pinentry-rofi.scm
+++ b/tests/pinentry-rofi.scm
@@ -144,12 +144,8 @@
#f
(lambda () #t))
"w")))
- (with-output-to-port
- fake-port
- (lambda ()
- (test-assert (pinentry-getinfo pinentry "GETINFO pid"))
- (test-equal (format #f "D ~a\n" (getpid)) output)))
-
+ (test-assert (pinentry-getinfo pinentry "GETINFO pid" #:port fake-port))
+ (test-equal (format #f "D ~a\n" (getpid)) output)
(test-assert (pinentry-getinfo pinentry "GETINFO foo bar"))
(test-assert (not (pinentry-getinfo pinentry " GETINFO foo bar")))
(test-assert (not (pinentry-getinfo pinentry "GETINFO")))
@@ -259,89 +255,77 @@
(display ":1"))
(set-pinentry-desc! pinentry description)
(set-pinentry-display! pinentry display)
- (with-output-to-port
- fake-port
- (lambda ()
- (test-assert (pinentry-getpin pinentry "GETPIN"
- (lambda* (#:key (env '())
- visibility
- (prompt ">")
- message
- buttons
- only-match)
- (test-equal "Prompt" prompt)
- (test-equal description message)
- (test-assert (not visibility))
- (test-assert (not only-match))
- (test-assert (not buttons))
- (test-equal `(("DISPLAY" . ,display)) env)
- "password")))
- (test-equal (format #f "D password") output)))
-
+ (test-assert (pinentry-getpin pinentry "GETPIN"
+ (lambda* (#:key (env '())
+ visibility
+ (prompt ">")
+ message
+ buttons
+ only-match)
+ (test-equal "Prompt" prompt)
+ (test-equal description message)
+ (test-assert (not visibility))
+ (test-assert (not only-match))
+ (test-assert (not buttons))
+ (test-equal `(("DISPLAY" . ,display)) env)
+ "password")
+ #:port fake-port))
+ (test-equal (format #f "D password") output)
(set-pinentry-error! pinentry error)
(set! output "")
- (with-output-to-port
- fake-port
- (lambda ()
- (test-assert (pinentry-getpin pinentry "GETPIN"
- (lambda* (#:key (env '())
- visibility
- (prompt ">")
- message
- buttons
- only-match)
- (test-equal "Prompt" prompt)
- (test-equal (format #f "~a&#10;~a" error description)
- message)
- (test-assert (not visibility))
- (test-assert (not only-match))
- (test-assert (not buttons))
- (test-equal `(("DISPLAY" . ,display)) env)
- "password")))
- (test-equal (format #f "D password") output)))
-
+ (test-assert (pinentry-getpin pinentry "GETPIN"
+ (lambda* (#:key (env '())
+ visibility
+ (prompt ">")
+ message
+ buttons
+ only-match)
+ (test-equal "Prompt" prompt)
+ (test-equal (format #f "~a&#10;~a" error description)
+ message)
+ (test-assert (not visibility))
+ (test-assert (not only-match))
+ (test-assert (not buttons))
+ (test-equal `(("DISPLAY" . ,display)) env)
+ "password")
+ #:port fake-port))
+ (test-equal (format #f "D password") output)
(set! output "")
- (with-output-to-port
- fake-port
- (lambda ()
- (test-assert (pinentry-getpin pinentry "GETPIN"
- (lambda* (#:key (env '())
- visibility
- (prompt ">")
- message
- buttons
- only-match)
- (test-equal "Prompt" prompt)
- (test-equal (format #f "~a&#10;~a" error description)
- message)
- (test-assert (not visibility))
- (test-assert (not only-match))
- (test-assert (not buttons))
- (test-equal `(("DISPLAY" . ,display)) env)
- "")))
- (test-equal (format #f "ERR 83886179 Operation cancelled <rofi>\n") output)))
-
+ (test-assert (pinentry-getpin pinentry "GETPIN"
+ (lambda* (#:key (env '())
+ visibility
+ (prompt ">")
+ message
+ buttons
+ only-match)
+ (test-equal "Prompt" prompt)
+ (test-equal (format #f "~a&#10;~a" error description)
+ message)
+ (test-assert (not visibility))
+ (test-assert (not only-match))
+ (test-assert (not buttons))
+ (test-equal `(("DISPLAY" . ,display)) env)
+ "")
+ #:port fake-port))
+ (test-equal (format #f "ERR 83886179 Operation cancelled <rofi>\n") output)
(set! output "")
- (with-output-to-port
- fake-port
- (lambda ()
- (test-assert (pinentry-getpin pinentry "GETPIN"
- (lambda* (#:key (env '())
- visibility
- (prompt ">")
- message
- buttons
- only-match)
- (test-equal "Prompt" prompt)
- (test-equal (format #f "~a&#10;~a" error description)
- message)
- (test-assert (not visibility))
- (test-assert (not only-match))
- (test-assert (not buttons))
- (test-equal `(("DISPLAY" . ,display)) env)
- " ")))
- (test-equal (format #f "ERR 83886179 Operation cancelled <rofi>\n") output)))
-
+ (test-assert (pinentry-getpin pinentry "GETPIN"
+ (lambda* (#:key (env '())
+ visibility
+ (prompt ">")
+ message
+ buttons
+ only-match)
+ (test-equal "Prompt" prompt)
+ (test-equal (format #f "~a&#10;~a" error description)
+ message)
+ (test-assert (not visibility))
+ (test-assert (not only-match))
+ (test-assert (not buttons))
+ (test-equal `(("DISPLAY" . ,display)) env)
+ " ")
+ #:port fake-port))
+ (test-equal (format #f "ERR 83886179 Operation cancelled <rofi>\n") output)
(test-assert (not (pinentry-getinfo pinentry " GETPIN")))
(test-assert (not (pinentry-getinfo pinentry "Foo"))))
@@ -376,27 +360,25 @@
#f
(lambda () #t))
"w")))
- (with-output-to-port
- fake-port
- (lambda ()
- (test-assert (pinentry-confirm
- pinentry
- "CONFIRM"
- (lambda* (#:key (env '())
- visibility
- (prompt ">")
- message
- buttons
- only-match)
- (test-equal ">" prompt)
- (test-equal (format #f "~a&#10;~a" error description)
- message)
- (test-assert visibility)
- (test-assert only-match)
- (test-equal `("Ok" "Cancel") buttons)
- (test-equal `(("DISPLAY" . ,display)) env)
- "Cancel")))
- (test-equal (format #f "ERR 277 Operation cancelled\n") output))))
+ (test-assert (pinentry-confirm
+ pinentry
+ "CONFIRM"
+ (lambda* (#:key (env '())
+ visibility
+ (prompt ">")
+ message
+ buttons
+ only-match)
+ (test-equal ">" prompt)
+ (test-equal (format #f "~a&#10;~a" error description)
+ message)
+ (test-assert visibility)
+ (test-assert only-match)
+ (test-equal `("Ok" "Cancel") buttons)
+ (test-equal `(("DISPLAY" . ,display)) env)
+ "Cancel")
+ #:port fake-port))
+ (test-equal (format #f "ERR 277 Operation cancelled\n") output))
(test-assert (not (pinentry-ok pinentry)))
(test-assert (not (pinentry-getinfo pinentry " CONFIRM")))
(test-assert (not (pinentry-getinfo pinentry "Foo"))))