minor change in test driver
This commit is contained in:
parent
8f87dbe008
commit
0d5907b726
@ -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))
|
||||
|
@ -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'
|
||||
|
||||
---
|
||||
|
||||
|
17
t/err.sh
17
t/err.sh
@ -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
|
||||
}
|
||||
|
@ -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 - +
|
||||
##}
|
||||
|
Loading…
Reference in New Issue
Block a user