aboutsummaryrefslogtreecommitdiff
path: root/tests/zcat.test
blob: 57af1097d03190f38a913dc24e0be49d764ebe22 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/bash

[ -f testing.sh ] && . testing.sh

#testing "name" "command" "result" "infile" "stdin"

echo -n "foo " | gzip > f1.gz
echo "bar" | gzip > f2.gz

# zcat is basically just `gzip -dc`...
testing "files" "zcat f1.gz f2.gz && test -f f1.gz && test -f f2.gz" \
    "foo bar\n" "" ""

# zcat -c is allowed, but the -c changes nothing.
testing "-c" "zcat -c f1.gz f2.gz && test -f f1.gz && test -f f2.gz" \
    "foo bar\n" "" ""

# TODO: how to test "zcat -f"?

rm -f f1 f2 f1.gz f2.gz