ttest.sh: stop at the first failing test case - neatvi - [fork] simple vi-type editor with UTF-8 support
HTML git clone git://src.adamsgaard.dk/neatvi
DIR Log
DIR Files
DIR Refs
DIR README
---
DIR commit caead42d731b8e10d6401d6028f63be6962fb0b2
DIR parent 29c43728954a02c8bfbd74722a456793481280b8
HTML Author: Ali Gholami Rudi <ali@rudi.ir>
Date: Mon, 24 Jan 2022 01:08:26 +0330
ttest.sh: stop at the first failing test case
Diffstat:
M test.sh | 24 +++++++++++++++---------
1 file changed, 15 insertions(+), 9 deletions(-)
---
DIR diff --git a/test.sh b/test.sh
t@@ -1,15 +1,21 @@
#!/bin/sh
-for x in test/e??.sh; do
+# testcase vi_options test.sh
+testcase() {
rm -f /tmp/.neatvi[12]
- sh $x /tmp/.neatvi2 2>/tmp/.neatvi1 | ./vi -s -e >/dev/null
- cmp -s /tmp/.neatvi[12] || echo "Failed: $x"
- cmp -s /tmp/.neatvi[12] || diff -u /tmp/.neatvi[12]
-done
+ printf "$x: "
+ sh $2 /tmp/.neatvi2 2>/tmp/.neatvi1 | ./vi $1 >/dev/null
+ if ! cmp -s /tmp/.neatvi[12]; then
+ printf "Failed\n"
+ diff -u /tmp/.neatvi[12]
+ exit 1
+ fi
+ printf "OK\n"
+}
+for x in test/e??.sh; do
+ testcase "-s -e" "$x"
+done
for x in test/v??.sh; do
- rm -f /tmp/.neatvi[12]
- sh $x /tmp/.neatvi2 2>/tmp/.neatvi1 | ./vi -v >/dev/null
- cmp -s /tmp/.neatvi[12] || echo "Failed: $x"
- cmp -s /tmp/.neatvi[12] || diff -u /tmp/.neatvi[12]
+ testcase "-v" "$x"
done