Fix uncaught mismatched paren error.

Add test against that error behavior.
Remove bits of unused code from web.c and tests.sh
This commit is contained in:
Sage Vaillancourt 2022-03-19 21:53:18 -04:00
parent c9be701b19
commit 4733e1172e
3 changed files with 4 additions and 10 deletions

View File

@ -9,8 +9,6 @@ FAIL_OUTPUT=""
VALGRIND=false
DISABLED=false
CURRENT_BLOCK=""
if [ "$1" == "-val" ]; then
VALGRIND=true
filter="$2"
@ -137,7 +135,7 @@ check "Identifying empty list" "(islist ())" "T"
check "Identifying not a list" "(islist 1)" "F"
deep_nesting="10"
for i in {0..25}; do deep_nesting="( $deep_nesting )"; done
for _ in {0..25}; do deep_nesting="( $deep_nesting )"; done
check "DeepNesting" "$deep_nesting" "$deep_nesting" # Above 25 it starts to stack-smash
title "Spacing"
@ -216,6 +214,7 @@ check "BadParens2" "(hey)(" regex "'MISMATCHED_PARENS.*"
check "BadParens3" "((hey(" regex "'MISMATCHED_PARENS.*"
check "BadParens4" ")))hey" regex "'MISMATCHED_PARENS.*"
check "BadParens5" "hey))(" regex "'MISMATCHED_PARENS.*"
check "BadParens6" '(ey")"' regex "'MISMATCHED_PARENS.*"
title "Eval"
check "BasicNumberEval" '(eval "5")' "5"

View File

@ -123,8 +123,7 @@ struct Slice* nf_tokenize(const char* input, struct Error* err)
}
i++;
} else {
while (!isWhitespace(input[++i]) && !isSingle(input[i]) &&
input[i] != '\0') {
while (!isWhitespace(input[++i]) && !isSingle(input[i]) && input[i] != '"' && input[i] != '\0') {
l++;
}
}

View File

@ -39,7 +39,7 @@ int methodMatches(const char* method, struct Route* route)
case GET:
return method[0] == 'G' || method[0] == 'g';
case POST:
return method[0] == 'P' || method[0] == 'p';
return (method[0] == 'P' || method[0] == 'p') && (method[1] == 'O' || method[1] == 'o');
default:
return 0;
}
@ -103,10 +103,6 @@ answer_to_connection(void* cls, struct MHD_Connection* connection,
HttpResult ret = MHD_queue_response(connection, MHD_HTTP_OK, response);
MHD_destroy_response(response);
// if (needsFree) {
// free(page);
// }
return ret;
}