diff options
author | Fredrik Salomonsson <plattfot@gmail.com> | 2020-05-11 17:00:30 -0700 |
---|---|---|
committer | Fredrik Salomonsson <plattfot@gmail.com> | 2020-05-11 17:00:30 -0700 |
commit | c0b982bb557f23a60c3d0f934c519abd7f749a88 (patch) | |
tree | caae65ed34b0adddb72d8ae984e877a1078d1d2a | |
parent | 04eb740c677beb6f54d591d198451d86986f6716 (diff) | |
download | pinentry-rofi-c0b982bb557f23a60c3d0f934c519abd7f749a88.tar.gz |
Add test for empty password and string-empty?
-rwxr-xr-x | pinentry-rofi.scm | 1 | ||||
-rwxr-xr-x | test.scm | 48 |
2 files changed, 47 insertions, 2 deletions
diff --git a/pinentry-rofi.scm b/pinentry-rofi.scm index 76fc0df..c0e7cd5 100755 --- a/pinentry-rofi.scm +++ b/pinentry-rofi.scm @@ -52,6 +52,7 @@ html-newline html-underline html-< + string-empty? hex->char input-string @@ -69,6 +69,8 @@ (test-equal "_Ok%0A_Cancel" (escape-underscore "__Ok%0A__Cancel")) (test-equal "_Ok _Cancel" (escape-underscore "__Ok __Cancel")) +(test-assert (string-empty? "")) +(test-assert (not (string-empty? "foo"))) (test-end "utils") (test-equal "This is one line\nThis is another%OA" @@ -294,7 +296,7 @@ buttons only-match) (test-equal "Prompt" prompt) - (test-equal (format #f "~a\n~a" error description) + (test-equal (format #f "~a ~a" error description) message) (test-assert (not visibility)) (test-assert (not only-match)) @@ -303,6 +305,48 @@ "password"))) (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 ~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))) + + (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 ~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 (not (pinentry-getinfo pinentry " GETPIN"))) (test-assert (not (pinentry-getinfo pinentry "Foo")))) @@ -350,7 +394,7 @@ buttons only-match) (test-equal ">" prompt) - (test-equal (format #f "~a\n~a" error description) + (test-equal (format #f "~a ~a" error description) message) (test-assert visibility) (test-assert only-match) |