summary refs log tree commit diff
path: root/tests/utils.scm
diff options
context:
space:
mode:
Diffstat (limited to 'tests/utils.scm')
-rw-r--r--tests/utils.scm11
1 files changed, 11 insertions, 0 deletions
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