From 7a8024a33ad862fdbc8ae741f0a6f5338cb5b82b Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sat, 22 Mar 2014 21:58:23 +0100 Subject: utils: Add 'decompressed-port' and 'compressed-port'. * guix/utils.scm (decompressed-port, compressed-port): New procedures. * guix/scripts/substitute-binary.scm (decompressed-port): Remove. (guix-substitute-binary): Pass a symbol or #f as the first argument to 'decompress-port'. * tests/utils.scm ("compressed-port, decompressed-port, non-file"): New test. --- tests/utils.scm | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'tests') diff --git a/tests/utils.scm b/tests/utils.scm index 85daa3db91..39cad701b8 100644 --- a/tests/utils.scm +++ b/tests/utils.scm @@ -150,6 +150,17 @@ (any (compose (negate zero?) cdr waitpid) pids)))) +(test-assert "compressed-port, decompressed-port, non-file" + (let ((data (call-with-input-file (search-path %load-path "guix.scm") + get-bytevector-all))) + (let*-values (((compressed pids1) + (compressed-port 'xz (open-bytevector-input-port data))) + ((decompressed pids2) + (decompressed-port 'xz compressed))) + (and (every (compose zero? cdr waitpid) + (append pids1 pids2)) + (equal? (get-bytevector-all decompressed) data))))) + (false-if-exception (delete-file temp-file)) (test-equal "fcntl-flock wait" 42 ; the child's exit status -- cgit 1.4.1