From 3fb2ac68e205bfb0d64529ca384db81011ea1135 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Sun, 30 May 2021 23:17:42 -0700 Subject: [PATCH] add some keyword tests --- tests/language/control/define.at | 70 ++++++++++++++++++++++++++++++-- 1 file changed, 66 insertions(+), 4 deletions(-) diff --git a/tests/language/control/define.at b/tests/language/control/define.at index a24ffb33c3..5117f0886e 100644 --- a/tests/language/control/define.at +++ b/tests/language/control/define.at @@ -24,8 +24,7 @@ $3 ]) AT_DATA([expout], [$4 ]) - AT_CHECK([pspp --testing-mode define.sps | sed '/^$/d'], [$6 -], [expout]) + AT_CHECK([pspp --testing-mode define.sps | sed '/^$/d'], [$6], [expout]) AT_CLEANUP]) AT_SETUP([simple macro expansion]) @@ -273,7 +272,7 @@ note: unexpanded token "b" note: unexpanded token "c" ]) AT_CLEANUP - + PSPP_CHECK_MACRO_EXPANSION([one !TOKENS(1) keyword argument], [DEFINE !k(arg1 = !TOKENS(1)) k(!arg1) !ENDDEFINE.], [!k arg1=x. @@ -282,4 +281,67 @@ PSPP_CHECK_MACRO_EXPANSION([one !TOKENS(1) keyword argument], [k(x) k(x) note: unexpanded token "y" -k( )]) \ No newline at end of file +k( )]) + +PSPP_CHECK_MACRO_EXPANSION([one !TOKENS(1) keyword argument - negative], + [DEFINE !k(arg1 = !TOKENS(1)) k(!arg1) !ENDDEFINE.], + [!k arg1. +!k arg1=.], [dnl +define.sps:3: error: DEBUG EXPAND: Found `.' while expecting `=' reading +argument !arg1 to macro !k. +note: unexpanded token "!k" +note: unexpanded token "arg1" +define.sps:4: error: DEBUG EXPAND: Unexpected end of command reading argument ! +arg1 to macro !k. +note: unexpanded token "!k" +note: unexpanded token "arg1" +note: unexpanded token "="], [1]) + +PSPP_CHECK_MACRO_EXPANSION([!CHAREND('/') keyword arguments], [dnl +DEFINE !k(arg1 = !CHAREND('/') + /arg2 = !CHAREND('/')) +k(!arg1, !arg2) +!ENDDEFINE.], + [!k arg1=x/ arg2=y/. +!k arg1=x/. +!k arg2=y/. +!k.], + [k(x, y) +k(x, ) +k(, y) +k(, )]) + +PSPP_CHECK_MACRO_EXPANSION([!CHAREND('/') keyword arguments - negative], [dnl +DEFINE !k(arg1 = !CHAREND('/') + /arg2 = !CHAREND('/')) +k(!arg1, !arg2) +!ENDDEFINE.], + [!k arg1. +!k arg1=. +!k arg1=x. +!k arg1=x/ arg2=y.], + [define.sps:6: error: DEBUG EXPAND: Found `.' while expecting `=' reading +argument !arg1 to macro !k. +note: unexpanded token "!k" +note: unexpanded token "arg1" +define.sps:7: error: DEBUG EXPAND: Unexpected end of command reading argument ! +arg1 to macro !k. +note: unexpanded token "!k" +note: unexpanded token "arg1" +note: unexpanded token "=" +define.sps:8: error: DEBUG EXPAND: Unexpected end of command reading argument ! +arg1 to macro !k. +note: unexpanded token "!k" +note: unexpanded token "arg1" +note: unexpanded token "=" +note: unexpanded token "x" +define.sps:9: error: DEBUG EXPAND: Unexpected end of command reading argument ! +arg2 to macro !k. +note: unexpanded token "!k" +note: unexpanded token "arg1" +note: unexpanded token "=" +note: unexpanded token "x" +note: unexpanded token "/" +note: unexpanded token "arg2" +note: unexpanded token "=" +note: unexpanded token "y"]) \ No newline at end of file -- 2.30.2