utils: Add 'canonical-newline-port'.

* guix/utils.scm (canonical-newline-port): New procedure.
* tests/utils.scm ("canonical-newline-port"): New test.
This commit is contained in:
Federico Beffa 2015-11-14 15:00:36 +01:00
parent 94abc84887
commit c8be6f0d4a
2 changed files with 38 additions and 2 deletions

View file

@ -318,6 +318,12 @@
(string-append (%store-prefix)
"/qvs2rj2ia5vci3wsdb7qvydrmacig4pg-bash-4.2-p24")))
(test-equal "canonical-newline-port"
"This is a journey\nInto the sound\nA journey ...\n"
(let ((port (open-string-input-port
"This is a journey\r\nInto the sound\r\nA journey ...\n")))
(get-string-all (canonical-newline-port port))))
(test-end)
(false-if-exception (delete-file temp-file))