diff options
author | Mattias Andrée <maandree@kth.se> | 2016-03-24 10:37:45 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2016-03-24 10:37:45 +0100 |
commit | 39201a315b9e8207bb3b0d912a4be2c82c04f021 (patch) | |
tree | 5bcd1d922fcddbe18fc340ff97abb3c4598572d9 /echo-test/test | |
parent | m (diff) | |
download | base-util-tests-39201a315b9e8207bb3b0d912a4be2c82c04f021.tar.gz base-util-tests-39201a315b9e8207bb3b0d912a4be2c82c04f021.tar.bz2 base-util-tests-39201a315b9e8207bb3b0d912a4be2c82c04f021.tar.xz |
add echo tests
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'echo-test/test')
-rwxr-xr-x | echo-test/test | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/echo-test/test b/echo-test/test new file mode 100755 index 0000000..dd43ea1 --- /dev/null +++ b/echo-test/test @@ -0,0 +1,31 @@ +#!/bin/bash + +cd -- "$(dirname "$0")" +if test -z "$ECHO"; then + TRUE=../echo +fi +e="$PREFIX $ECHO" +N=10 + +report () +{ + if test $1 = 0; then + printf "\033[1;32mTest %s OK\033[m\n" "$2" + else + printf "\033[1;31mTest %s FAILED\033[m\n" "$2" + fi +} + +if test $# = 0; then + set $(seq 1 $N) +fi +( +for f in $@; do + diff <($e $(cat $f)) $f > /dev/null + report $? "$f" +done +) | tee result +! grep FAILED < result >/dev/null +ret=$? +rm result +exit $ret |