File tree Expand file tree Collapse file tree 4 files changed +28
-10
lines changed
Expand file tree Collapse file tree 4 files changed +28
-10
lines changed Original file line number Diff line number Diff line change 1+ on : push
2+
3+ jobs :
4+ Scripts :
5+ name : " Unit Test Scripts"
6+ runs-on : ubuntu-latest
7+
8+ steps :
9+ - name : Install Lua
10+ run : |
11+ sudo apt-get update
12+ sudo apt-get install -y lua5.4
13+
14+ - uses : actions/checkout@v4
15+
16+ - name : Run script unit tests
17+ run : |
18+ find test -name test.sh -executable -print -execdir ./{} \;
Original file line number Diff line number Diff line change @@ -9,18 +9,18 @@ test_case() {
99 cp " case$1 " /* result
1010 cd " result" || die
1111 $INTERP $SCRIPT a.txt b.txt > " diff"
12- patch -s --batch -p0 < " diff"
12+ patch -s --posix -- batch -p0 < " diff"
1313 if cmp -s a.txt b.txt; then
14- echo " CASE $1 : PASS"
14+ printf " \tCASE %s : PASS\n " " $1 "
1515 else
16- echo " CASE $1 : FAIL"
16+ printf " \tCASE %s : FAIL\n " " $1 "
1717 FAIL=$(( FAIL + 1 ))
1818 fi
1919 cd .. || die
2020 rm -R result
2121}
22-
22+ echo " DIFF: "
2323for i in $( seq -w 1 16) ; do test_case " $i " ; done
2424echo " "
25- if [ $FAIL -gt 0 ]; then echo " $FAIL FAIL" exit 1; fi
26- echo " ALL PASS"
25+ if [ $FAIL -gt 0 ]; then echo " DIFF: $FAIL FAIL" exit 1; fi
26+ echo " DIFF: ALL PASS"
Original file line number Diff line number Diff line change @@ -8,9 +8,9 @@ GNU=$(md5sum $SCRIPT)
88LUA=$( $INTERP $SCRIPT $SCRIPT )
99
1010if [ " $GNU " = " $LUA " ]; then
11- echo " $TEST PASS"
11+ echo " $TEST : PASS"
1212 exit 0
1313else
14- echo " $TEST FAIL"
14+ echo " $TEST : FAIL"
1515 exit 1
1616fi
Original file line number Diff line number Diff line change @@ -8,9 +8,9 @@ GNU=$(sha256sum $SCRIPT)
88LUA=$( $INTERP $SCRIPT $SCRIPT )
99
1010if [ " $GNU " = " $LUA " ]; then
11- echo " $TEST PASS"
11+ echo " $TEST : PASS"
1212 exit 0
1313else
14- echo " $TEST FAIL"
14+ echo " $TEST : FAIL"
1515 exit 1
1616fi
You can’t perform that action at this time.
0 commit comments