From 26177b3f9fa8447b9d27faf827711b4d86fde69c Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Mon, 28 Jun 2021 18:28:13 -0700 Subject: [PATCH] Add keyword argument test. --- tests/language/control/define.at | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/tests/language/control/define.at b/tests/language/control/define.at index 930b9ddf4c..92f255fbcc 100644 --- a/tests/language/control/define.at +++ b/tests/language/control/define.at @@ -1123,4 +1123,31 @@ COMPUTE x = !vars x. AT_CHECK([pspp -O format=csv define.sps], [1], [dnl define.sps:3.13-3.19: error: COMPUTE: Syntax error at `b' (in expansion of `!vars x'): expecting end of command. ]) +AT_CLEANUP + +dnl A macro with keyword arguments needs a token of lookahead +dnl to find out whether another keyword is present. Test that +dnl this special case works OK. +AT_SETUP([macro calls in each others' lookahead]) +AT_DATA([define.sps], [dnl +DEFINE !k(x=!DEFAULT(0) !TOKENS(1)/y=!DEFAULT(0) !TOKENS(1)) +(x=!x)(y=!y) +!ENDDEFINE. +DEBUG EXPAND. +!k +!k x=1 +!k y=2 +!k y=2 x=1 +!k x=1 y=2. +]) +AT_CHECK([pspp -O format=csv define.sps --testing-mode], [0], [dnl +(x = 0) (y = 0) + +(x = 1) (y = 0) + +(x = 0) (y = 2) +(x = 1) (y = 2) + +(x = 1) (y = 2) +]) AT_CLEANUP \ No newline at end of file -- 2.30.2