improve macro error messages
[pspp] / tests / language / control / define.at
index fa87f9a1de9f1c9859938f309b48cd4f1a3d7692..adfd18c8848e6c4d1399026ffdfddcbaf51b9927 100644 (file)
@@ -585,9 +585,9 @@ DEFINE !macro()
 !ENDDEFINE.
 !macro.
 ])
-AT_CHECK([pspp define.sps], [1], [dnl
+AT_CHECK([pspp -O format=csv define.sps], [1], [dnl
 maximum nesting level exceeded
-define.sps.1: error: Syntax error at `!macro': expecting command name.
+define.sps:4.1-4.6: error: Syntax error at `!macro' (in expansion of `!macro'): expecting command name.
 ])
 AT_CLEANUP
 
@@ -1104,12 +1104,23 @@ for command in TITLE SUBTITLE; do
 DEFINE !paste(!POS !TOKENS(1) / !POS !TOKENS(1))
 !CONCAT(!1,!2)
 !ENDDEFINE.
-$command prefix !paste foo bar.
+$command prefix !paste foo bar suffix.
 SHOW $command.
 EOF
     cat >expout <<EOF
-title.sps:2: note: SHOW: $command is foo  bar.
+title.sps:5: note: SHOW: $command is prefix foobar suffix.
 EOF
     AT_CHECK([pspp -O format=csv title.sps], [0], [expout])
 done
+AT_CLEANUP
+
+AT_SETUP([error message within macro expansion])
+AT_DATA([define.sps], [dnl
+DEFINE !vars(!POS !TOKENS(1)) a b C !ENDDEFINE.
+DATA LIST NOTABLE /a b 1-2.
+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
\ No newline at end of file