mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 17:07:47 +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,15 +1,19 @@
|
|||
#!/bin/sh
|
||||
|
||||
test "$*" = "" || echo "Fail: Argv list not empty" && exit 1
|
||||
test "$#" -eq 0 || echo "Fail: Argv list empty but count non-zero" && exit 1
|
||||
test "$ARGV" = "$*" || echo "Fail: \$ARGV not equal to \$*" && exit 1
|
||||
source test-commons.inc
|
||||
|
||||
if not test "$*" = "" { fail "Argv list not empty" }
|
||||
if not test "$#" -eq 0 { fail "Argv list empty but count non-zero" }
|
||||
if not test "$ARGV" = "$*" { fail "\$ARGV not equal to \$*" }
|
||||
|
||||
ARGV=(1 2 3)
|
||||
test "$#" -eq 3 || echo "Fail: Assignment to ARGV does not affect \$#" && exit 1
|
||||
test "$*" = "1 2 3" || echo "Fail: Assignment to ARGV does not affect \$*" && exit 1
|
||||
if not test "$#" -eq 3 { fail "Assignment to ARGV does not affect \$#" }
|
||||
if not test "$*" = "1 2 3" { fail "Assignment to ARGV does not affect \$*" }
|
||||
|
||||
shift
|
||||
test "$*" = "2 3" || echo "Fail: 'shift' does not work correctly" && exit 1
|
||||
if not test "$*" = "2 3" { fail "'shift' does not work correctly" }
|
||||
|
||||
shift 2
|
||||
test "$*" = "" || echo "Fail: 'shift 2' does not work correctly" && exit 1
|
||||
if not test "$*" = "" { fail "'shift 2' does not work correctly" }
|
||||
|
||||
echo PASS
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue