[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#55845] [PATCH 1/1] ui: Improve pager selection logic when less is n
From: |
Maxime Devos |
Subject: |
[bug#55845] [PATCH 1/1] ui: Improve pager selection logic when less is not installed. |
Date: |
Thu, 09 Jun 2022 21:43:11 +0200 |
User-agent: |
Evolution 3.38.3-1 |
Taiju HIGASHI schreef op do 09-06-2022 om 19:23 [+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.
The return value of 'with-paginated-output-port' is just whatever the
last expression put in that macro evaluates to. Also 'close-pipe'
needs to be mocked, otherwise an error will result.
Try:
(test-assert "with-paginated-output-port: finds less in PATH"
(call-with-temporary-directory
(lambda (dir)
(define used-command #false)
(with-environment-variables
`(("PATH" ,dir))
(make-dummy-executable-file dir "less")
(mock ((ice-9 popen) open-pipe*
(lambda (mode command . args)
(when used-command ; <--- an extra test
(error "open-pipe* should only be called once"))
(set! used-command command) ; <--- this captures the passed
command
(%make-void-port ""))) ; return a dummy port
(mock ((ice-9 popen) close-pipe (const 'ok))
(mock ((guix colors) isatty?* (const #t))
(with-paginated-output-port port 'ok)))))
(and (pk 'used-command used-command dir) ; <-- fails on my computer
because a non-absolute path is passed and I haven't applied our patch
(string=? (in-vicinity dir "less") used-command)))))
Greetings,
Maxime.
signature.asc
Description: This is a digitally signed message part
- [bug#55845] [PATCH 0/1] Improve pager selection logic when less is not installed, Taiju HIGASHI, 2022/06/08
- [bug#55845] [PATCH 1/1] ui: Improve pager selection logic when less is not installed., Taiju HIGASHI, 2022/06/08
- [bug#55845] [PATCH 1/1] ui: Improve pager selection logic when less is not installed., Maxime Devos, 2022/06/08
- [bug#55845] [PATCH 1/1] ui: Improve pager selection logic when less is not installed., Taiju HIGASHI, 2022/06/09
- [bug#55845] [PATCH 1/1] ui: Improve pager selection logic when less is not installed., Taiju HIGASHI, 2022/06/09
- [bug#55845] [PATCH 1/1] ui: Improve pager selection logic when less is not installed.,
Maxime Devos <=
- [bug#55845] [PATCH 1/1] ui: Improve pager selection logic when less is not installed., Taiju HIGASHI, 2022/06/09
- [bug#55845] [PATCH 1/1] ui: Improve pager selection logic when less is not installed., Maxime Devos, 2022/06/10
- [bug#55845] [PATCH 1/1] ui: Improve pager selection logic when less is not installed., Taiju HIGASHI, 2022/06/10
- [bug#55845] [PATCH 1/1] ui: Improve pager selection logic when less is not installed., Maxime Devos, 2022/06/10
- [bug#55845] [PATCH 1/1] ui: Improve pager selection logic when less is not installed., Taiju HIGASHI, 2022/06/11
- [bug#55845] [PATCH 1/1] ui: Improve pager selection logic when less is not installed., Taiju HIGASHI, 2022/06/14
- [bug#55845] [PATCH 1/1] ui: Improve pager selection logic when less is not installed., Maxime Devos, 2022/06/15
- [bug#55845] [PATCH 0/1] Improve pager selection logic when less is not installed, Ludovic Courtès, 2022/06/16
- [bug#55845] [PATCH 0/1] Improve pager selection logic when less is not installed, Taiju HIGASHI, 2022/06/16
- [bug#55845] [PATCH 0/1] Improve pager selection logic when less is not installed, Ludovic Courtès, 2022/06/17