aboutsummaryrefslogtreecommitdiffstats
path: root/echo-test/test
diff options
context:
space:
mode:
Diffstat (limited to 'echo-test/test')
-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