From 892a874a68097af0c15ffbe717b91c05a6354cdb Mon Sep 17 00:00:00 2001 From: Nick Bowler Date: Wed, 24 Feb 2021 00:49:04 -0500 Subject: [PATCH] Add a couple more positive tests. A review of the ChangeLog suggests we regressed on 'int **' at some point, so it seems like a good idea to explicitly test this. Also test int (*) because thought I had found an error but of course the robot was correct and I was wrong: there was no such error. Validate both the type name and declaration forms for each. --- tests/decl-good.at | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/tests/decl-good.at b/tests/decl-good.at index 5b8b9a6..b0e648e 100644 --- a/tests/decl-good.at +++ b/tests/decl-good.at @@ -15,13 +15,22 @@ AT_BANNER([C declarations]) -m4_define([CHECK_DECL], -[AT_DATA([expout], [[$2]m4_newline]) -AT_CHECK([cdecl99 -e 'explain $1'], [0], [expout])]) +m4_define([CHECK_DECLS], +[AT_CHECK([cdecl99 m4_map_args_sep([-e 'explain ], ['], [ ], m4_shift($@))], + [0], [[$1]m4_ifval([$1], [ +])])]) -m4_define([SIMPLE_DECL], -[AT_SETUP([$1]) -CHECK_DECL([$1], [$2]) +m4_define([SIMPLE_DECLS], +[AT_SETUP([Accept m4_car($1)]) +CHECK_DECLS(m4_join([ +], $2), $1) AT_CLEANUP]) +m4_define([SIMPLE_DECL], [SIMPLE_DECLS([[$1]], [[$2]])]) +SIMPLE_DECLS([[int **], [int **x]], + [[type pointer to pointer to int], + [declare x as pointer to pointer to int]]) +SIMPLE_DECLS([[int (*x)], [int (*)]], + [[declare x as pointer to int], + [type pointer to int]]) SIMPLE_DECL([int (x*)], [type function (pointer to x) returning int]) -- 2.43.2