1#!/bin/bash 2 3[ -f testing.sh ] && . testing.sh 4 5#testing "name" "command" "result" "infile" "stdin" 6 7echo -n "hi " | gzip > 1.gz 8echo "there" | gzip > 2.gz 9 10# zcat is basically just gzip -dc 11testcmd "files" "1.gz 2.gz && test -f 1.gz && test -f 2.gz" "hi there\n" "" "" 12# zcat -c is allowed but changes nothing 13testcmd "-c" "-c 1.gz 2.gz && test -f 1.gz && test -f 2.gz" "hi there\n" "" "" 14testing "concatenated" "{ cat 1.gz 2.gz; } | zcat" "hi there\n" "" "" 15testing "error" "head -c 10 2.gz | { zcat 2>/dev/null || echo fail; }" "fail\n"\ 16 "" "" 17 18# TODO: how to test "zcat -f"? 19 20rm -f 1 2 1.gz 2.gz 21