aboutsummaryrefslogtreecommitdiffstats
path: root/echo-test/test
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2016-03-24 10:37:45 +0100
committerMattias Andrée <maandree@kth.se>2016-03-24 10:37:45 +0100
commit39201a315b9e8207bb3b0d912a4be2c82c04f021 (patch)
tree5bcd1d922fcddbe18fc340ff97abb3c4598572d9 /echo-test/test
parentm (diff)
downloadbase-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 '')
-rwxr-xr-xecho-test/test31
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