Add keyword argument test.
authorBen Pfaff <blp@cs.stanford.edu>
Tue, 29 Jun 2021 01:28:13 +0000 (18:28 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Tue, 29 Jun 2021 01:28:13 +0000 (18:28 -0700)
tests/language/control/define.at

index 930b9ddf4c4bc3f55452a872dea988cced758c3e..92f255fbccc9f0feaaf7e6f21550e34918632564 100644 (file)
@@ -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