aboutsummaryrefslogtreecommitdiffstats
path: root/tests/pinentry-rofi.bats
blob: 8c7748ebfd609d2810f307a877651cb41baf7ae9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
#!/usr/bin/env bats

## (define-module (tests-pinentry-rofi)
##   #:use-module (srfi srfi-64)
##   #:use-module (ice-9 popen)
##   #:use-module (ice-9 textual-ports)
##   #:use-module (pinentry-rofi))

# XXX (test-begin "pinentry-rofi")

# XXX ;; (test-begin "pinentry")
# XXX (let ((pinentry (make-pinentry #t "Prompt" "Ok" "Cancel" ":1" "test.log" "C" "C")))
# XXX   (test-assert (pinentry? pinentry))
# XXX   (test-assert (pinentry-ok pinentry))
# XXX   (test-equal "Prompt" (pinentry-prompt pinentry))
# XXX   (test-equal "Ok" (pinentry-ok-button pinentry))
# XXX   (test-equal "Cancel" (pinentry-cancel-button pinentry))
# XXX   (test-equal ":1" (pinentry-display pinentry))
# XXX   (test-equal "test.log" (pinentry-logfile pinentry))
# XXX   (test-assert (not (pinentry-notok-button pinentry)))
# XXX   (test-assert (not (pinentry-visibility pinentry)))
# XXX   (test-assert (not (pinentry-error pinentry))))
# XXX
# XXX (let ((pinentry (make-pinentry #f "Prompt" "Ok" "Cancel" ":1" "test.log" "C" "C")))
# XXX   (test-assert (not (pinentry-ok pinentry))))
# XXX
# XXX ;; (test-end "pinentry")
# XXX
# XXX ;; (test-begin "utils")
# XXX
# XXX (test-equal "Ok" (remove-underline "_Ok"))
# XXX (test-equal " Ok" (remove-underline " _Ok"))
# XXX (test-equal "foo_bar" (remove-underline "foo_bar"))
# XXX (test-equal "foo__bar" (remove-underline "foo__bar"))
# XXX (test-equal " __Ok" (remove-underline " __Ok"))
# XXX (test-equal "__Ok" (remove-underline "__Ok"))
# XXX (test-equal "Ok%0ACancel" (remove-underline "_Ok%0A_Cancel"))
# XXX (test-equal "Ok
Cancel" (remove-underline "_Ok
_Cancel"))
# XXX
# XXX (test-equal "_Ok" (escape-underscore "_Ok"))
# XXX (test-equal " _Ok" (escape-underscore " _Ok"))
# XXX (test-equal "foo_bar" (escape-underscore "foo_bar"))
# XXX (test-equal "foo__bar" (escape-underscore "foo__bar"))
# XXX (test-equal " _Ok" (escape-underscore " __Ok"))
# XXX (test-equal "_Ok" (escape-underscore "__Ok"))
# XXX (test-equal "_Ok%0A_Cancel" (escape-underscore "__Ok%0A__Cancel"))
# XXX (test-equal "_Ok
_Cancel" (escape-underscore "__Ok
__Cancel"))
# XXX
# XXX (test-assert (string-empty? ""))
# XXX (test-assert (not (string-empty? "foo")))
# XXX ;; (test-end "utils")
# XXX
# XXX (test-equal "This is one line\nThis is another%OA"
# XXX   (hex->char "%54his is one line%0AThis is another%OA"))
# XXX
# XXX ;; (test-begin "html")
# XXX (test-equal "%54his is one line
This is another%OA"
# XXX   (html-newline "%54his is one line%0AThis is another%OA"))
# XXX (test-equal "%54his is one line\nThis is another%OA"
# XXX   (html-newline "%54his is one line\nThis is another%OA"))
# XXX
# XXX (test-equal "<u>O</u>k" (html-underline "_Ok"))
# XXX (test-equal " <u>O</u>k" (html-underline " _Ok"))
# XXX (test-equal "foo_bar" (html-underline "foo_bar"))
# XXX (test-equal "foo__bar" (html-underline "foo__bar"))
# XXX (test-equal " __Ok" (html-underline " __Ok"))
# XXX (test-equal "__Ok" (html-underline "__Ok"))
# XXX (test-equal "<u>O</u>k%0A<u>C</u>ancel" (html-underline "_Ok%0A_Cancel"))
# XXX (test-equal "<u>O</u>k&#10;<u>C</u>ancel" (html-underline "_Ok&#10;_Cancel"))
# XXX
# XXX ;; (test-end "html")
# XXX
# XXX (test-equal "<u>T</u>his is one line&#10;<u>T</u>his is another%OA"
# XXX   (pango-markup "_%54his is one line%0A_This is another%OA"))
# XXX
# XXX (test-equal "Ok\nCancel"
# XXX   (input-string "_Ok\nCancel"))
# XXX
# XXX (test-equal "Ok\n_Cancel"
# XXX   (input-string "_Ok\n__Cancel"))
# XXX
# XXX (let ((pinentry (make-pinentry #f "Prompt" "Ok" "Cancel" ":1" "test.log" "C" "C")))
# XXX   (pinentry-set set-pinentry-notok-button! pinentry "Not ok")
# XXX   (test-equal "Not ok" (pinentry-notok-button pinentry))
# XXX   (test-assert (pinentry-ok pinentry)))
# XXX
# XXX (let ((pinentry (make-pinentry #f "Prompt" "Ok" "Cancel" ":1" "test.log" "C" "C")))
# XXX   (test-error #t (pinentry-set pinentry-notok-button pinentry "Not ok")))
# XXX
# XXX (let ((pinentry (make-pinentry #f "Prompt" "Ok" "Cancel" ":1" "test.log" "C" "C")))
# XXX   (test-assert (pinentry-option pinentry "OPTION default-ok=Okay"))
# XXX   (test-equal "Okay" (pinentry-ok-button pinentry))
# XXX   (test-equal "Cancel" (pinentry-cancel-button pinentry))
# XXX   (test-equal "Prompt" (pinentry-prompt pinentry))
# XXX   (test-equal "C" (pinentry-lc-ctype pinentry))
# XXX   (test-equal "C" (pinentry-lc-messages pinentry))
# XXX   (test-assert (pinentry-ok pinentry)))
# XXX
# XXX (let ((pinentry (make-pinentry #f "Prompt" "Ok" "Cancel" ":1" "test.log" "C" "C")))
# XXX   (test-assert (pinentry-option pinentry "OPTION default-cancel=No"))
# XXX   (test-equal "Ok" (pinentry-ok-button pinentry))
# XXX   (test-equal "No" (pinentry-cancel-button pinentry))
# XXX   (test-equal "Prompt" (pinentry-prompt pinentry))
# XXX   (test-equal "C" (pinentry-lc-ctype pinentry))
# XXX   (test-equal "C" (pinentry-lc-messages pinentry))
# XXX   (test-assert (pinentry-ok pinentry)))
# XXX
# XXX (let ((pinentry (make-pinentry #f "Prompt" "Ok" "Cancel" ":1" "test.log" "C" "C")))
# XXX   (test-assert (pinentry-option pinentry "OPTION default-prompt=Password:"))
# XXX   (test-equal "Ok" (pinentry-ok-button pinentry))
# XXX   (test-equal "Cancel" (pinentry-cancel-button pinentry))
# XXX   (test-equal "Password:" (pinentry-prompt pinentry))
# XXX   (test-equal "C" (pinentry-lc-ctype pinentry))
# XXX   (test-equal "C" (pinentry-lc-messages pinentry))
# XXX   (test-assert (pinentry-ok pinentry)))
# XXX
# XXX (let ((pinentry (make-pinentry #f "Prompt" "Ok" "Cancel" ":1" "test.log" "C" "C")))
# XXX   (test-assert (pinentry-option pinentry "OPTION lc-ctype=en_US.UTF-8"))
# XXX   (test-equal "Ok" (pinentry-ok-button pinentry))
# XXX   (test-equal "Cancel" (pinentry-cancel-button pinentry))
# XXX   (test-equal "Prompt" (pinentry-prompt pinentry))
# XXX   (test-equal "en_US.UTF-8" (pinentry-lc-ctype pinentry))
# XXX   (test-equal "C" (pinentry-lc-messages pinentry))
# XXX   (test-assert (pinentry-ok pinentry)))
# XXX
# XXX (let ((pinentry (make-pinentry #f "Prompt" "Ok" "Cancel" ":1" "test.log" "C" "C")))
# XXX   (test-assert (pinentry-option pinentry "OPTION lc-messages=en_US.UTF-8"))
# XXX   (test-equal "Ok" (pinentry-ok-button pinentry))
# XXX   (test-equal "Cancel" (pinentry-cancel-button pinentry))
# XXX   (test-equal "Prompt" (pinentry-prompt pinentry))
# XXX   (test-equal "C" (pinentry-lc-ctype pinentry))
# XXX   (test-equal "en_US.UTF-8" (pinentry-lc-messages pinentry))
# XXX   (test-assert (pinentry-ok pinentry)))
# XXX
# XXX (let ((pinentry (make-pinentry #f "Prompt" "Ok" "Cancel" ":1" "test.log" "C" "C")))
# XXX   (test-assert (pinentry-option pinentry "OPTION foo bar")))
# XXX
# XXX (let ((pinentry (make-pinentry #f "Prompt" "Ok" "Cancel" ":1" "test.log" "C" "C")))
# XXX   (test-assert (not (pinentry-option pinentry " OPTION foo bar")))
# XXX   (test-assert (not (pinentry-option pinentry "OPTION")))
# XXX   (test-assert (not (pinentry-option pinentry "Foo"))))
# XXX
# XXX (let* ((pinentry (make-pinentry #f "Prompt" "Ok" "Cancel" ":1" "test.log" "C" "C"))
# XXX        (output "")
# XXX        (fake-port (make-soft-port
# XXX                   (vector
# XXX                    (lambda (c) (set! output (string-append output c)))
# XXX                    (lambda (s) (set! output (string-append output s)))
# XXX                    (lambda () #t)
# XXX                    #f
# XXX                    (lambda () #t))
# XXX                   "w")))
# XXX   (test-assert (pinentry-getinfo pinentry "GETINFO pid" #:port fake-port))
# XXX   (test-equal (format #f "D ~a\n" (getpid)) output)
# XXX   (test-assert (pinentry-getinfo pinentry "GETINFO foo bar"))
# XXX   (test-assert (not (pinentry-getinfo pinentry " GETINFO foo bar")))
# XXX   (test-assert (not (pinentry-getinfo pinentry "GETINFO")))
# XXX   (test-assert (not (pinentry-getinfo pinentry "Foo"))))
# XXX
# XXX (let* ((pinentry (make-pinentry #f "Prompt" "Ok" "Cancel" ":1" "test.log" "C" "C")))
# XXX   (test-assert (pinentry-setkeyinfo pinentry "SETKEYINFO Foo"))
# XXX   (test-assert (pinentry-ok pinentry))
# XXX   (test-assert (not (pinentry-setkeyinfo pinentry " SETKEYINFO foo bar")))
# XXX   (test-assert (not (pinentry-setkeyinfo pinentry "SETKEYINFO")))
# XXX   (test-assert (not (pinentry-setkeyinfo pinentry "Foo"))))
# XXX
# XXX (let* ((pinentry (make-pinentry #f "Prompt" "Ok" "Cancel" ":1" "test.log" "C" "C")))
# XXX   (test-assert (pinentry-setok pinentry "SETOK Foo"))
# XXX   (test-equal "Foo" (pinentry-ok-button pinentry))
# XXX   (test-assert (pinentry-ok pinentry))
# XXX   (test-assert (pinentry-setok pinentry "SETOK _Ok okay"))
# XXX   (test-equal "Ok okay" (pinentry-ok-button pinentry))
# XXX   (test-assert (not (pinentry-setok pinentry " SETOK foo bar")))
# XXX   (test-equal "Ok okay" (pinentry-ok-button pinentry))
# XXX   (test-assert (not (pinentry-setok pinentry "SETOK")))
# XXX   (test-equal "Ok okay" (pinentry-ok-button pinentry))
# XXX   (test-assert (not (pinentry-setok pinentry "Foo")))
# XXX   (test-equal "Ok okay" (pinentry-ok-button pinentry)))
# XXX
# XXX (let* ((pinentry (make-pinentry #f "Prompt" "Ok" "Cancel" ":1" "test.log" "C" "C")))
# XXX   (test-assert (pinentry-setnotok pinentry "SETNOTOK Foo"))
# XXX   (test-equal "Foo" (pinentry-notok-button pinentry))
# XXX   (test-assert (pinentry-ok pinentry))
# XXX   (test-assert (pinentry-setnotok pinentry "SETNOTOK Not _Ok"))
# XXX   (test-equal "Not Ok" (pinentry-notok-button pinentry))
# XXX   (test-assert (not (pinentry-setnotok pinentry " SETNOTOK foo bar")))
# XXX   (test-equal "Not Ok" (pinentry-notok-button pinentry))
# XXX   (test-assert (not (pinentry-setnotok pinentry "SETNOTOK")))
# XXX   (test-equal "Not Ok" (pinentry-notok-button pinentry))
# XXX   (test-assert (not (pinentry-setnotok pinentry "Foo")))
# XXX   (test-equal "Not Ok" (pinentry-notok-button pinentry)))
# XXX
# XXX (let* ((pinentry (make-pinentry #f "Prompt" "Ok" "Cancel" ":1" "test.log" "C" "C")))
# XXX   (test-assert (pinentry-setcancel pinentry "SETCANCEL Foo"))
# XXX   (test-equal "Foo" (pinentry-cancel-button pinentry))
# XXX   (test-assert (pinentry-ok pinentry))
# XXX   (test-assert (pinentry-setcancel pinentry "SETCANCEL _Abort"))
# XXX   (test-equal "Abort" (pinentry-cancel-button pinentry))
# XXX   (test-assert (not (pinentry-setcancel pinentry " SETCANCEL foo bar")))
# XXX   (test-equal "Abort" (pinentry-cancel-button pinentry))
# XXX   (test-assert (not (pinentry-setcancel pinentry "SETCANCEL")))
# XXX   (test-equal "Abort" (pinentry-cancel-button pinentry))
# XXX   (test-assert (not (pinentry-setcancel pinentry "Foo")))
# XXX   (test-equal "Abort" (pinentry-cancel-button pinentry)))
# XXX
# XXX (let* ((pinentry (make-pinentry #f "Prompt" "Ok" "Desc" ":1" "test.log" "C" "C")))
# XXX   (test-assert (pinentry-setdesc pinentry "SETDESC Foo"))
# XXX   (test-equal "Foo" (pinentry-desc pinentry))
# XXX   (test-assert (pinentry-ok pinentry))
# XXX   (test-assert (pinentry-setdesc pinentry "SETDESC _%54his is a description%0A_On two lines"))
# XXX   (test-equal "<u>T</u>his is a description&#10;<u>O</u>n two lines" (pinentry-desc pinentry))
# XXX   (test-assert (not (pinentry-setdesc pinentry " SETDESC foo bar")))
# XXX   (test-equal "<u>T</u>his is a description&#10;<u>O</u>n two lines" (pinentry-desc pinentry))
# XXX   (test-assert (not (pinentry-setdesc pinentry "SETDESC")))
# XXX   (test-equal "<u>T</u>his is a description&#10;<u>O</u>n two lines" (pinentry-desc pinentry))
# XXX   (test-assert (not (pinentry-setdesc pinentry "Foo")))
# XXX   (test-equal "<u>T</u>his is a description&#10;<u>O</u>n two lines" (pinentry-desc pinentry)))
# XXX
# XXX (let* ((pinentry (make-pinentry #f "Prompt" "Ok" "Error" ":1" "test.log" "C" "C")))
# XXX   (test-assert (pinentry-seterror pinentry "SETERROR Foo"))
# XXX   (test-equal "Foo" (pinentry-error pinentry))
# XXX   (test-assert (pinentry-ok pinentry))
# XXX   (test-assert (pinentry-seterror pinentry "SETERROR _%54his is an error%0A_On two lines"))
# XXX   (test-equal "<u>T</u>his is an error&#10;<u>O</u>n two lines" (pinentry-error pinentry))
# XXX   (test-assert (not (pinentry-seterror pinentry " SETERROR foo bar")))
# XXX   (test-equal "<u>T</u>his is an error&#10;<u>O</u>n two lines" (pinentry-error pinentry))
# XXX   (test-assert (not (pinentry-seterror pinentry "SETERROR")))
# XXX   (test-equal "<u>T</u>his is an error&#10;<u>O</u>n two lines" (pinentry-error pinentry))
# XXX   (test-assert (not (pinentry-seterror pinentry "Foo")))
# XXX   (test-equal "<u>T</u>his is an error&#10;<u>O</u>n two lines" (pinentry-error pinentry)))
# XXX
# XXX (let* ((pinentry (make-pinentry #f "Prompt" "Ok" "Prompt" ":1" "test.log" "C" "C")))
# XXX   (test-assert (pinentry-setprompt pinentry "SETPROMPT Foo"))
# XXX   (test-equal "Foo" (pinentry-prompt pinentry))
# XXX   (test-assert (pinentry-ok pinentry))
# XXX   (test-assert (pinentry-setprompt pinentry "SETPROMPT _%54his is a prompt%0A_On two lines"))
# XXX   (test-equal "<u>T</u>his is a prompt&#10;<u>O</u>n two lines" (pinentry-prompt pinentry))
# XXX   (test-assert (not (pinentry-setprompt pinentry " SETPROMPT foo bar")))
# XXX   (test-equal "<u>T</u>his is a prompt&#10;<u>O</u>n two lines" (pinentry-prompt pinentry))
# XXX   (test-assert (not (pinentry-setprompt pinentry "SETPROMPT")))
# XXX   (test-equal "<u>T</u>his is a prompt&#10;<u>O</u>n two lines" (pinentry-prompt pinentry))
# XXX   (test-assert (not (pinentry-setprompt pinentry "Foo")))
# XXX   (test-equal "<u>T</u>his is a prompt&#10;<u>O</u>n two lines" (pinentry-prompt pinentry)))
# XXX
# XXX (let* ((pinentry (make-pinentry #f "Prompt" "Ok" "Prompt" ":1" "test.log" "C" "C")))
# XXX   (test-error "(quit #t)" (pinentry-bye pinentry "BYE"))
# XXX   (test-assert (not (pinentry-bye pinentry "Hej då"))))
# XXX
# XXX (let* ((pinentry (make-pinentry #f "Prompt" "Ok" "Cancel" ":1" "test.log" "C" "en_US.UTF-8"))
# XXX        (output "")
# XXX        (fake-port (make-soft-port
# XXX                   (vector
# XXX                    (lambda (c) (set! output (string-append output c)))
# XXX                    (lambda (s) (set! output (string-append output s)))
# XXX                    (lambda () #t)
# XXX                    #f
# XXX                    (lambda () #t))
# XXX                   "w"))
# XXX        (description "This is a description")
# XXX        (error "Something went wrong")
# XXX        (display ":1"))
# XXX   (set-pinentry-desc! pinentry description)
# XXX   (set-pinentry-display! pinentry display)
# XXX   (test-assert (pinentry-getpin pinentry "GETPIN"
# XXX                                 (lambda* (#:key (env '())
# XXX                                           visibility
# XXX                                           (prompt ">")
# XXX                                           message
# XXX                                           buttons
# XXX                                           only-match)
# XXX                                   (test-equal "Prompt" prompt)
# XXX                                   (test-equal description message)
# XXX                                   (test-assert (not visibility))
# XXX                                   (test-assert (not only-match))
# XXX                                   (test-assert (not buttons))
# XXX                                   (test-equal `(("DISPLAY" . ,display)
# XXX                                                 ("LC_CTYPE" . "C")
# XXX                                                 ("LC_MESSAGES" . "en_US.UTF-8"))
# XXX                                     env)
# XXX                                   "password")
# XXX                                 #:port fake-port))
# XXX   (test-equal (format #f "D password") output)
# XXX   (set-pinentry-error! pinentry error)
# XXX   (set! output "")
# XXX   (test-assert (pinentry-getpin pinentry "GETPIN"
# XXX                                 (lambda* (#:key (env '())
# XXX                                           visibility
# XXX                                           (prompt ">")
# XXX                                           message
# XXX                                           buttons
# XXX                                           only-match)
# XXX                                   (test-equal "Prompt" prompt)
# XXX                                   (test-equal (format #f "~a&#10;~a" error description)
# XXX                                     message)
# XXX                                   (test-assert (not visibility))
# XXX                                   (test-assert (not only-match))
# XXX                                   (test-assert (not buttons))
# XXX                                   (test-equal `(("DISPLAY" . ,display)
# XXX                                                 ("LC_CTYPE" . "C")
# XXX                                                 ("LC_MESSAGES" . "en_US.UTF-8"))
# XXX                                     env)
# XXX                                   "password")
# XXX                                 #:port fake-port))
# XXX   (test-equal (format #f "D password") output)
# XXX   (set! output "")
# XXX   (test-assert (pinentry-getpin pinentry "GETPIN"
# XXX                                 (lambda* (#:key (env '())
# XXX                                           visibility
# XXX                                           (prompt ">")
# XXX                                           message
# XXX                                           buttons
# XXX                                           only-match)
# XXX                                   (test-equal "Prompt" prompt)
# XXX                                   (test-equal (format #f "~a&#10;~a" error description)
# XXX                                     message)
# XXX                                   (test-assert (not visibility))
# XXX                                   (test-assert (not only-match))
# XXX                                   (test-assert (not buttons))
# XXX                                   (test-equal `(("DISPLAY" . ,display)
# XXX                                                 ("LC_CTYPE" . "C")
# XXX                                                 ("LC_MESSAGES" . "en_US.UTF-8"))
# XXX                                     env)
# XXX                                   "")
# XXX                                 #:port fake-port))
# XXX   (test-equal (format #f "ERR 83886179 Operation cancelled <rofi>\n") output)
# XXX   (set! output "")
# XXX   (test-assert (pinentry-getpin pinentry "GETPIN"
# XXX                                 (lambda* (#:key (env '())
# XXX                                           visibility
# XXX                                           (prompt ">")
# XXX                                           message
# XXX                                           buttons
# XXX                                           only-match)
# XXX                                   (test-equal "Prompt" prompt)
# XXX                                   (test-equal (format #f "~a&#10;~a" error description)
# XXX                                     message)
# XXX                                   (test-assert (not visibility))
# XXX                                   (test-assert (not only-match))
# XXX                                   (test-assert (not buttons))
# XXX                                   (test-equal `(("DISPLAY" . ,display)
# XXX                                                 ("LC_CTYPE" . "C")
# XXX                                                 ("LC_MESSAGES" . "en_US.UTF-8"))
# XXX                                     env)
# XXX                                   "  ")
# XXX                                 #:port fake-port))
# XXX   (test-equal (format #f "ERR 83886179 Operation cancelled <rofi>\n") output)
# XXX   (test-assert (not (pinentry-getinfo pinentry " GETPIN")))
# XXX   (test-assert (not (pinentry-getinfo pinentry "Foo"))))
# XXX
# XXX (let* ((pinentry (make-pinentry #f "Prompt" "Ok" "Cancel" ":1" "test.log" "C" "en_US.UTF-8"))
# XXX        (description "This is a description")
# XXX        (error "Something went wrong")
# XXX        (display ":1"))
# XXX   (set-pinentry-desc! pinentry description)
# XXX   (set-pinentry-display! pinentry display)
# XXX   (test-assert (pinentry-confirm pinentry "CONFIRM"
# XXX                                 (lambda* (#:key (env '())
# XXX                                                 visibility
# XXX                                                 (prompt ">")
# XXX                                                 message
# XXX                                                 buttons
# XXX                                                 only-match)
# XXX                                   (test-equal ">" prompt)
# XXX                                   (test-equal description message)
# XXX                                   (test-assert visibility)
# XXX                                   (test-assert only-match)
# XXX                                   (test-equal `("Ok" "Cancel") buttons)
# XXX                                   (test-equal `(("DISPLAY" . ,display)
# XXX                                                 ("LC_CTYPE" . "C")
# XXX                                                 ("LC_MESSAGES" . "en_US.UTF-8"))
# XXX                                     env)
# XXX                                   "Ok")))
# XXX   (test-assert (pinentry-ok pinentry))
# XXX   (set-pinentry-error! pinentry error)
# XXX   (let* ((output "")
# XXX          (fake-port (make-soft-port
# XXX                      (vector
# XXX                       (lambda (c) (set! output (string-append output c)))
# XXX                       (lambda (s) (set! output (string-append output s)))
# XXX                       (lambda () #t)
# XXX                       #f
# XXX                       (lambda () #t))
# XXX                      "w")))
# XXX     (test-assert (pinentry-confirm
# XXX                   pinentry
# XXX                   "CONFIRM"
# XXX                   (lambda* (#:key (env '())
# XXX                             visibility
# XXX                             (prompt ">")
# XXX                             message
# XXX                             buttons
# XXX                             only-match)
# XXX                     (test-equal ">" prompt)
# XXX                     (test-equal (format #f "~a&#10;~a" error description)
# XXX                       message)
# XXX                     (test-assert visibility)
# XXX                     (test-assert only-match)
# XXX                     (test-equal `("Ok" "Cancel") buttons)
# XXX                     (test-equal `(("DISPLAY" . ,display)
# XXX                                   ("LC_CTYPE" . "C")
# XXX                                   ("LC_MESSAGES" . "en_US.UTF-8"))
# XXX                       env)
# XXX                     "Cancel")
# XXX                   #:port fake-port))
# XXX     (test-equal (format #f "ERR 277 Operation cancelled\n") output))
# XXX   (test-assert (not (pinentry-ok pinentry)))
# XXX   (test-assert (not (pinentry-getinfo pinentry " CONFIRM")))
# XXX   (test-assert (not (pinentry-getinfo pinentry "Foo"))))
# XXX
# XXX (let* ((pinentry (make-pinentry #f "Prompt" "Ok" "Cancel" ":1" "test.log" "C" "en_US.UTF-8"))
# XXX        (description "This is a description")
# XXX        (display ":1"))
# XXX   (set-pinentry-desc! pinentry description)
# XXX   (set-pinentry-display! pinentry display)
# XXX   (test-assert (pinentry-confirm pinentry "CONFIRM --one-button"
# XXX                                 (lambda* (#:key (env '())
# XXX                                                 visibility
# XXX                                                 (prompt ">")
# XXX                                                 message
# XXX                                                 buttons
# XXX                                                 only-match)
# XXX                                   (test-equal ">" prompt)
# XXX                                   (test-equal description message)
# XXX                                   (test-assert visibility)
# XXX                                   (test-assert only-match)
# XXX                                   (test-equal `("Ok") buttons)
# XXX                                   (test-equal `(("DISPLAY" . ,display)
# XXX                                                 ("LC_CTYPE" . "C")
# XXX                                                 ("LC_MESSAGES" . "en_US.UTF-8"))
# XXX                                     env)
# XXX                                   "Ok")))
# XXX   (test-assert (pinentry-ok pinentry))
# XXX   (set-pinentry-ok! pinentry #f)
# XXX   (test-assert (pinentry-confirm pinentry "MESSAGE"
# XXX                                  (lambda* (#:key (env '())
# XXX                                                  visibility
# XXX                                                  (prompt ">")
# XXX                                                  message
# XXX                                                  buttons
# XXX                                                  only-match)
# XXX                                    (test-equal ">" prompt)
# XXX                                    (test-equal description message)
# XXX                                    (test-assert visibility)
# XXX                                    (test-assert only-match)
# XXX                                    (test-equal `("Ok") buttons)
# XXX                                    (test-equal `(("DISPLAY" . ,display)
# XXX                                                  ("LC_CTYPE" . "C")
# XXX                                                  ("LC_MESSAGES" . "en_US.UTF-8"))
# XXX                                      env)
# XXX                                    "Ok")))
# XXX   (test-assert (pinentry-ok pinentry))
# XXX   (test-assert (not (pinentry-getinfo pinentry " CONFIRM --one-button")))
# XXX   (test-assert (not (pinentry-getinfo pinentry "MESSAGE --one-button")))
# XXX   (test-assert (not (pinentry-getinfo pinentry " MESSAGE")))
# XXX   (test-assert (not (pinentry-getinfo pinentry "Foo"))))
# XXX
# XXX (test-end "pinentry-rofi")