summaryrefslogtreecommitdiff
path: root/tests/regression.at
diff options
context:
space:
mode:
authorAkim Demaille <akim.demaille@gmail.com>2019-07-11 07:58:47 +0200
committerAkim Demaille <akim.demaille@gmail.com>2019-08-09 05:39:30 -0500
commit99bfdc09cbaba39bfad40bbe368fcec29b64fefd (patch)
tree3f13d5145206aef930655a2a8cd4140334cf269b /tests/regression.at
parent52f21717f7885046ab1bc63d727c180f0ee62885 (diff)
downloadbison-99bfdc09cbaba39bfad40bbe368fcec29b64fefd.tar.gz
tests: prepare LAC tests for more languages
* tests/regression.at: Use %expect to avoid warnings. Set the keywords to facilitate running specific tests. Use macros such as AT_YYLEX_DECLARE to facilitate tests for other languages. Likewise for AT_FULL_COMPILE.
Diffstat (limited to 'tests/regression.at')
-rw-r--r--tests/regression.at43
1 files changed, 19 insertions, 24 deletions
diff --git a/tests/regression.at b/tests/regression.at
index aabe8515..b593bae6 100644
--- a/tests/regression.at
+++ b/tests/regression.at
@@ -1302,6 +1302,7 @@ AT_CLEANUP
## ------------------------ ##
AT_SETUP([[LAC: Exploratory stack]])
+AT_KEYWORDS([lac])
m4_pushdef([AT_LAC_CHECK], [
@@ -1310,13 +1311,13 @@ AT_BISON_OPTION_PUSHDEFS([%debug $1])
AT_DATA_GRAMMAR([input.y],
[[%code {
]AT_YYERROR_DECLARE[
- int yylex (]AT_PURE_IF([[YYSTYPE *]], [[void]])[);
+ ]AT_YYLEX_DECLARE[
}
%debug
]$1[
%define parse.error verbose
%token 'c'
-
+%expect 21
%%
// default reductions in inconsistent states
@@ -1331,23 +1332,16 @@ C: %empty { printf ("consistent default reduction\n"); } ;
%%
]AT_YYERROR_DEFINE[
-int
-yylex (]AT_PURE_IF([[YYSTYPE *v]], [[void]])[)
-{
- static char const *input = "bbbbc";]AT_PURE_IF([[
- *v = 0;]])[
- return *input++;
-}
+]AT_YYLEX_DEFINE(["bbbbc"])[
]AT_MAIN_DEFINE[
]])
-AT_BISON_CHECK([[-Dparse.lac=full -Dparse.lac.es-capacity-initial=1 \
- -Dparse.lac.memory-trace=full \
- -o input.c input.y]], [[0]], [],
-[[input.y: warning: 21 shift/reduce conflicts [-Wconflicts-sr]
-]])
-AT_COMPILE([[input]])
+AT_FULL_COMPILE([[input]], [], [], [],
+ [[-Dparse.lac=full]AT_C_IF([ \
+ -Dparse.lac.es-capacity-initial=1 \
+ -Dparse.lac.memory-trace=full])])
+
AT_PARSER_CHECK([[input --debug > stdout.txt 2> stderr.txt]], [[1]])
# Make sure syntax error doesn't forget that 'a' is expected. It would
@@ -1366,10 +1360,12 @@ AT_CHECK([[$PERL -0777 -ne 'print s/inconsistent default reduction//g;' \
AT_CHECK([[$PERL -0777 -ne 'print s/\bconsistent default reduction//g;' \
< stdout.txt || exit 77]], [[0]], [[2]])
-# Check number of reallocs to be sure reallocated memory isn't somehow
-# lost between LAC invocations.
-AT_CHECK([[$PERL -0777 -ne 'print s/\(realloc//g;' < stderr.txt \
- || exit 77]], [[0]], [[3]])
+]AT_C_IF([[
+ # Check number of reallocs to be sure reallocated memory isn't somehow
+ # lost between LAC invocations.
+ AT_CHECK([[$PERL -0777 -ne 'print s/\(realloc//g;' < stderr.txt \
+ || exit 77]], [[0]], [[3]])
+]])[
AT_BISON_OPTION_POPDEFS
])
@@ -1390,6 +1386,7 @@ AT_CLEANUP
## ------------------------ ##
AT_SETUP([[LAC: Memory exhaustion]])
+AT_KEYWORDS([lac])
m4_pushdef([AT_LAC_CHECK],
[AT_BISON_OPTION_PUSHDEFS([%debug])
@@ -1401,7 +1398,7 @@ AT_DATA_GRAMMAR([input.y],
}
%debug
%define parse.error verbose
-
+%expect 8
%%
S: A A A A A A A A A ;
@@ -1413,10 +1410,8 @@ A: %empty | 'a' ;
]AT_MAIN_DEFINE[
]])
-AT_BISON_CHECK([[-Dparse.lac=full -Dparse.lac.es-capacity-initial=1 \
- -o input.c input.y]], [[0]], [],
-[[input.y: warning: 8 shift/reduce conflicts [-Wconflicts-sr]
-]])
+AT_FULL_COMPILE([input], [], [], [],
+ [[-Dparse.lac=full -Dparse.lac.es-capacity-initial=1]])
AT_COMPILE([[input]])
AT_BISON_OPTION_POPDEFS
])