simple 1.18 KB
Newer Older
1 2
#!/bin/sh

3 4 5
# Simple test suite for "since" to be used with Debian's autopkgtest
# package. Author: Axel Beckert <abe@debian.org>

6 7 8 9 10
set -e

cd "$ADTTMP"
export HOME="$ADTTMP"

11 12
echo USING: `which since`

13 14 15 16 17 18 19
# Cleanup
rm -f .since example.txt example.txt

# Functionality testing
echo TESTING: -z
echo foo > example.txt
echo bar > example2.txt
20 21
test -z "`since -z example.txt`" || ( cat .since && exit 2 )
test -z "`since -z example2.txt`" || ( cat .since && exit 3 )
22 23 24

echo TESTING: default action
echo bar >> example.txt
25
test "`since example.txt`" = "bar" || ( cat .since && exit 4 )
26 27 28 29

echo TESTING: reset
echo fnord > example.txt
test "`since example.txt 2>&1`" = "since: considering example.txt to be truncated, displaying from start
30
fnord" || ( cat .since && exit 5 )
31 32 33 34 35

echo TESTING: -z multiple files
echo hurz >> example.txt
echo bla >> example2.txt
test "`since -z example.txt example2.txt`" = "==> example.txt [discarded] <==
36
==> example2.txt [discarded] <==" || ( cat .since && exit 6 )
37 38 39 40 41 42 43

echo TESTING: default action multiple files
echo flarp >> example.txt
echo gnarz >> example2.txt
test "`since example.txt example2.txt`" = "==> example.txt <==
flarp
==> example2.txt <==
44
gnarz" || ( cat .since && exit 7 )