toybox/tests/zcat.test
<<
>>
Prefs
   1#!/bin/bash
   2
   3[ -f testing.sh ] && . testing.sh
   4
   5#testing "name" "command" "result" "infile" "stdin"
   6
   7echo -n "foo " | gzip > f1.gz
   8echo "bar" | gzip > f2.gz
   9
  10# zcat is basically just `gzip -dc`...
  11testing "files" "zcat f1.gz f2.gz && test -f f1.gz && test -f f2.gz" \
  12    "foo bar\n" "" ""
  13
  14# zcat -c is allowed, but the -c changes nothing.
  15testing "-c" "zcat -c f1.gz f2.gz && test -f f1.gz && test -f f2.gz" \
  16    "foo bar\n" "" ""
  17
  18# TODO: how to test "zcat -f"?
  19
  20rm -f f1 f2 f1.gz f2.gz
  21