add some keyword tests
authorBen Pfaff <blp@cs.stanford.edu>
Mon, 31 May 2021 06:17:42 +0000 (23:17 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Mon, 31 May 2021 06:17:42 +0000 (23:17 -0700)
tests/language/control/define.at

index a24ffb33c3dd3bdf55a085c3dd8c4440d873777f..5117f0886ead380fccec4bbb97a8e9d136013606 100644 (file)
@@ -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
-\f
+
 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