!LET
[pspp] / tests / language / control / define.at
index 1f57851732df3367dd6fe76043d52dbfd4247526..0571303da1b8a6f049f9a63c692328419f9ecb68 100644 (file)
@@ -384,12 +384,20 @@ PSPP_CHECK_MACRO_EXPANSION([!CONCAT],
 !CONCAT('x', 'y').
 !CONCAT(12, 34).
 !CONCAT(!NULL, 123).
+!CONCAT(x, 0).
+!CONCAT(x, 0, y).
+!CONCAT(0, x).
+!CONCAT(0, x, y).
 !ENDDEFINE],
   [!c.],
   [xy.
 xy.
 1234.
-123.])
+123.
+x0.
+x0y.
+0 x.
+0 xy.])
 
 dnl Keep this test in sync with the examples for !EVAL in the manual.
 PSPP_CHECK_MACRO_EXPANSION([!EVAL],
@@ -713,3 +721,38 @@ true true false
 done
 AT_CLEANUP
 
+AT_SETUP([macro !LET])
+AT_KEYWORDS([let])
+AT_DATA([define.sps], [dnl
+DEFINE !macro(!POS !CMDEND)
+!LET !v1 = !CONCAT('x',!1,'y')
+!LET !v2 = !QUOTE(!v1)
+!LET !v3 = (!LENGTH(!1) = 1)
+!LET !v4 = (!SUBSTR(!1, 3) = !NULL)
+v1=!v1.
+v2=!v2.
+v3=!v3.
+v4=!v4.
+!ENDDEFINE.
+DEBUG EXPAND.
+!macro 0.
+!macro.
+!macro xyzzy.
+])
+AT_CHECK([pspp --testing-mode define.sps], [0], [dnl
+v1 = x0y.
+v2 = 'x0y'.
+v3 = 1.
+v4 = 1.
+
+v1 = xy.
+v2 = 'xy'.
+v3 = 0.
+v4 = 1.
+
+v1 = xxyzzyy.
+v2 = 'xxyzzyy'.
+v3 = 0.
+v4 = 0.
+])
+AT_CLEANUP
\ No newline at end of file