From: Ben Pfaff Date: Tue, 29 Jun 2021 01:28:13 +0000 (-0700) Subject: Add keyword argument test. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=26177b3f9fa8447b9d27faf827711b4d86fde69c;p=pspp Add keyword argument test. --- 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