]> git.draconx.ca Git - cdecl99.git/blobdiff - tests/decl-good.at
Add a couple more positive tests.
[cdecl99.git] / tests / decl-good.at
index 5b8b9a661f9c385ee9870d2c2aec1d7606d03c1d..b0e648e1b38d89c90243712af4eae4cb460268d6 100644 (file)
 
 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])