update
This commit is contained in:
@@ -16,6 +16,28 @@ assert_nonempty() {
|
||||
assert_contains() {
|
||||
if [[ ! "$1" =~ $2 ]]; then fail "$3"; fi
|
||||
}
|
||||
|
||||
# Ensure output does not contain any of the common error phrases.
|
||||
assert_no_common_errors() {
|
||||
local output="$1"
|
||||
local -a patterns=(
|
||||
"ACSH_ACTIVE_API_KEY not set"
|
||||
"Bad Request"
|
||||
"Unauthorized"
|
||||
"Too Many Requests"
|
||||
"Internal Server Error"
|
||||
"Unknown Error"
|
||||
"Failed to parse completions"
|
||||
"SyntaxError"
|
||||
"ERROR:"
|
||||
)
|
||||
for pat in "${patterns[@]}"; do
|
||||
if grep -qE "$pat" <<<"$output"; then
|
||||
printf "Test failed: output contains error pattern '%s'\nFull output follows:\n%s\n" "$pat" "$output"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
}
|
||||
# --------------------------------
|
||||
|
||||
echo "=== SETUP ==="
|
||||
@@ -50,6 +72,7 @@ pass "finish config contains lmstudio"
|
||||
out=$(finish command "ls # show largest files" 2>&1) ; code=$?
|
||||
assert_ok $code "finish command did not exit 0"
|
||||
assert_nonempty "$out" "finish command returned empty output"
|
||||
assert_no_common_errors "$out"
|
||||
pass "finish command executed and returned output"
|
||||
|
||||
# ------------------------------- CLEANUP --------------------------------
|
||||
|
||||
Reference in New Issue
Block a user