summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/utils.scm19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/utils.scm b/tests/utils.scm
index 39cad701b8..adbfdf55ba 100644
--- a/tests/utils.scm
+++ b/tests/utils.scm
@@ -162,6 +162,25 @@
(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
(let ((file (open-file temp-file "w0")))