Make SDK tests use bash exit instead of return (#579)

* Use exit instead of return in bash scripts

Return is to return from functions, not scripts.

* Test scripts: exit 1 y files differ
This commit is contained in:
Ismael Celis 2025-02-03 13:16:49 +00:00 committed by GitHub
parent 1d8105af11
commit 97c0760a48
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 6 deletions

View File

@ -7,10 +7,10 @@ input=$(cat "$1/input.json")
[ -f "$1/testOutput.txt" ] && rm "$1/testOutput.txt"
curl -sN --get -H "datastar-request" --data-urlencode "datastar=$input" "$2/test" -o "$1/testOutput.txt"
curl -sN --get -H "datastar-request" --data-urlencode "datastar=$input" "$2/test" -o "$1/testOutput.txt"
[ ! -f "$1/testOutput.txt" ] && echo "case $1 failed: your server did not return anything" && return 1
diff -q "$1/testOutput.txt" "$1/output.txt"
diff -q "$1/testOutput.txt" "$1/output.txt" || { exit 1; }
return 0
exit 0

View File

@ -6,10 +6,10 @@
[ -f "$1/testOutput.txt" ] && rm "$1/testOutput.txt"
input=$(cat "$1/input.json")
curl -sN -H "datastar-request" --json "$input" "$2/test" -o "$1/testOutput.txt"
curl -sN -H "datastar-request" --json "$input" "$2/test" -o "$1/testOutput.txt"
[ ! -f "$1/testOutput.txt" ] && echo "case $1 failed: your server did not return anything" && return 1
diff -q "$1/testOutput.txt" "$1/output.txt"
diff -q "$1/testOutput.txt" "$1/output.txt" || { exit 1; }
return 0
exit 0