minor change in test driver

This commit is contained in:
hyung-hwan 2024-07-13 13:33:20 +09:00
parent 8f87dbe008
commit 0d5907b726
4 changed files with 15 additions and 10 deletions

View File

@ -2311,7 +2311,7 @@ static int compile_if (hcl_t* hcl, hcl_cnode_t* src)
if (!obj)
{
/* no value */
hcl_setsynerrbfmt (hcl, HCL_SYNERR_ARGCOUNT, HCL_CNODE_GET_LOC(src), HCL_NULL, "no conditional expression after %.*js", HCL_CNODE_GET_TOKLEN(cmd), HCL_CNODE_GET_TOKPTR(cmd));
hcl_setsynerrbfmt (hcl, HCL_SYNERR_ARGCOUNT, HCL_CNODE_GET_LOC(src), HCL_NULL, "no conditional expression after '%.*js'", HCL_CNODE_GET_TOKLEN(cmd), HCL_CNODE_GET_TOKPTR(cmd));
return -1;
}
else if (!HCL_CNODE_IS_CONS(obj))
@ -2412,7 +2412,7 @@ static HCL_INLINE int compile_elif (hcl_t* hcl)
if (!obj)
{
/* no value */
hcl_setsynerrbfmt (hcl, HCL_SYNERR_ARGCOUNT, HCL_CNODE_GET_LOC(src), HCL_NULL, "no conditional expression after %.*js", HCL_CNODE_GET_TOKLEN(cmd), HCL_CNODE_GET_TOKPTR(cmd));
hcl_setsynerrbfmt (hcl, HCL_SYNERR_ARGCOUNT, HCL_CNODE_GET_LOC(src), HCL_NULL, "no conditional expression after '%.*js'", HCL_CNODE_GET_TOKLEN(cmd), HCL_CNODE_GET_TOKPTR(cmd));
return -1;
}
else if (!HCL_CNODE_IS_CONS(obj))

View File

@ -15,7 +15,7 @@ while(i < 20) {
---
if ##ERROR: syntax error - no conditional expression after if
if ##ERROR: syntax error - no conditional expression after 'if'
---

View File

@ -27,14 +27,19 @@ run_partfile() {
return 1
}
l_expected_errline=$(echo $l_expected_errinfo | cut -d: -f1)
l_xlen=$(echo $l_expected_errline | wc -c)
l_expected_errline=$(echo "$l_expected_errinfo" | cut -d: -f1)
l_xlen=$(echo "$l_expected_errline" | wc -c)
l_xlen=$(expr $l_xlen + 10)
l_expected_errmsg=$(echo $l_expected_errinfo | cut -c${l_xlen}-)
l_expected_errmsg=$(echo "$l_expected_errinfo" | cut -c${l_xlen}-)
l_output=`$l_cmd 2>&1`
## the regular expression is not escaped properly. the error information must not
## include specifial regex characters to avoid problems.
echo "$l_output" | grep -E "ERROR:.+${l_partfile}\[${l_expected_errline},[[:digit:]]+\] ${l_expected_errmsg}" >/dev/null 2>&1 || {
## the checks using grep may not be 100% accurate depending on message patterns.
## but it's unlikely such a case really happens
echo "$l_output" | grep -q -E "^ERROR:.+${l_partfile}\[${l_expected_errline},[[:digit:]]+\] .+" 2>&1 || {
echo "ERROR: error not raised at line $l_expected_errline - $l_script($l_partno) - $l_output"
return 1
}
echo "$l_output" | grep -q -F " ${l_expected_errmsg}" 2>&1 || {
echo "ERROR: error not raised at line $l_expected_errline - $l_script($l_partno) - $l_output"
return 1
}

View File

@ -49,5 +49,5 @@ class A [ a + ] { ##ERROR: syntax error - prohibited binary operator - +
## TODO: This check is supposed to fail. + must be treated as a binop symbol
##---
##class A [ + ] { ##ERROR: syntax error - prohibited binary operator - +
##class A [ + ] { ## ERROR: syntax error - prohibited binary operator - +
##}