Subject: [bug#55845] [PATCH 1/1] ui: Improve pager selection logic when less is not installed.

From: Taiju HIGASHI <[email-masked]>
Date: Thu, 09 Jun 2022 19:23:20 +0900

Hi Maxime,

I tried to mock open-pipe* and isatty?* using the mock macro and also
add a test to inspect the program coming across to open-pipe*, but gave
up because I could not get the return value of the
with-paginated-output-port macro.

I think we are one step closer, but it is not working.
I will share a piece of code in the process of verification just in
case.

(test-equal "with-paginated-output-port"
  "less"
  (call-with-temporary-directory
   (lambda (dir)
     (with-environment-variables
         `(("PATH" ,dir))
       (make-dummy-executable-file dir "less")
       (mock ((ice-9 popen) open-pipe*
              (lambda (mode command . args)
                (current-output-port)))
             (mock ((guix colors) isatty?* (const #t))
                   (with-paginated-output-port paginated
                     "less")))))))

I have debugged that the return value of dynamic-wind is "less", but I
could not successfully use it for assertions.

I also tried to inspect the value of the command argument using
test-equal in the open-pipe* mock replacement function, but it did not
work.

Is there a better way to do this?

Thanks,
-- 
Taiju