From 80dea563a3dad98bda60385188509ca79a3651f8 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 24 Mar 2014 21:09:15 +0100 Subject: utils: Add 'filtered-output-port' and 'compressed-output-port'. * guix/utils.scm (filtered-output-port, compressed-output-port): New procedures. * tests/utils.scm ("compressed-output-port + decompressed-port"): New test. --- tests/utils.scm | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'tests') diff --git a/tests/utils.scm b/tests/utils.scm index 39cad701b8..adbfdf55ba 100644 --- a/tests/utils.scm +++ b/tests/utils.scm @@ -161,6 +161,25 @@ (append pids1 pids2)) (equal? (get-bytevector-all decompressed) data))))) +(false-if-exception (delete-file temp-file)) +(test-equal "compressed-output-port + decompressed-port" + '((0) "Hello, compressed port!") + (let ((text "Hello, compressed port!") + (output (open-file temp-file "w0b"))) + (let-values (((compressed pids) + (compressed-output-port 'xz output))) + (display text compressed) + (close-port compressed) + (close-port output) + (and (every (compose zero? cdr waitpid) pids) + (let*-values (((input) + (open-file temp-file "r0b")) + ((decompressed pids) + (decompressed-port 'xz input))) + (let ((str (get-string-all decompressed))) + (list (map (compose cdr waitpid) pids) + str))))))) + (false-if-exception (delete-file temp-file)) (test-equal "fcntl-flock wait" 42 ; the child's exit status -- cgit 1.4.1