mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 00:37:35 +00:00
Shell: Make tests use PASS/FAIL instead of exit codes
There's no guarantee that the last executed command will have a zero exit code, and so the shell exit code may or may not be zero, even if all the tests pass. Also changes the `test || echo fail && exit` to `if not test { echo fail && exit }`, since that's nicer-looking.
This commit is contained in:
parent
5ec139e728
commit
86f50aa74e
14 changed files with 177 additions and 128 deletions
|
@ -1,5 +1,7 @@
|
|||
#!/bin/sh
|
||||
|
||||
source test-commons.inc
|
||||
|
||||
singlecommand_ok=yes
|
||||
multicommand_ok=yes
|
||||
inlineexec_ok=yes
|
||||
|
@ -65,13 +67,20 @@ for $(yes) {
|
|||
break
|
||||
}
|
||||
|
||||
test $singlecommand_ok || echo Fail: Single command inside for body
|
||||
test $multicommand_ok || echo Fail: Multiple commands inside for body
|
||||
test $inlineexec_ok || echo Fail: Inline Exec
|
||||
test $implicit_ok || echo Fail: implicit iter variable
|
||||
test $infinite_ok || echo Fail: infinite loop
|
||||
test $break_ok || echo Fail: break
|
||||
test $continue_ok || echo Fail: continue
|
||||
test $break_in_infinite_ok || echo Fail: break from external infinite loop
|
||||
if not test $singlecommand_ok { fail Single command inside for body }
|
||||
if not test $multicommand_ok { fail Multiple commands inside for body }
|
||||
if not test $inlineexec_ok { fail Inline Exec }
|
||||
if not test $implicit_ok { fail implicit iter variable }
|
||||
if not test $infinite_ok { fail infinite loop }
|
||||
if not test $break_ok { fail break }
|
||||
if not test $continue_ok { fail continue }
|
||||
if not test $break_in_infinite_ok { fail break from external infinite loop }
|
||||
|
||||
test "$singlecommand_ok $multicommand_ok $inlineexec_ok $implicit_ok $infinite_ok $break_ok $continue_ok $break_in_infinite_ok" = "yes yes yes yes yes yes yes yes" || exit 1
|
||||
if not test \
|
||||
"$singlecommand_ok $multicommand_ok $inlineexec_ok $implicit_ok $infinite_ok $break_ok $continue_ok $break_in_infinite_ok" \
|
||||
= "yes yes yes yes yes yes yes yes" {
|
||||
|
||||
fail "Something failed :("
|
||||
}
|
||||
|
||||
echo PASS
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue