GRAPH: Improve error messages and coding style.
[pspp] / tests / language / stats / graph.at
index 750c192be9496a5eb0fa6b131d720dc29af64cf3..7a5d0a447033ed22d9c9260410072f17a6ad8207 100644 (file)
@@ -435,3 +435,210 @@ Count: 28.512; Cat: "    5.00", "    1.00"
 ])
 
 AT_CLEANUP
+
+AT_SETUP([GRAPH syntax errors])
+AT_DATA([graph.sps], [dnl
+DATA LIST LIST NOTABLE/x y z.
+GRAPH/HISTOGRAM=x/HISTOGRAM=y.
+GRAPH/HISTOGRAM(**).
+GRAPH/HISTOGRAM(NORMAL **).
+GRAPH/HISTOGRAM=**.
+GRAPH/HISTOGRAM=x y z.
+GRAPH/HISTOGRAM=x/BAR=y.
+GRAPH/BAR(GROUPED).
+GRAPH/BAR(STACKED).
+GRAPH/BAR(RANGE).
+GRAPH/BAR(**).
+GRAPH/BAR **.
+GRAPH/BAR=**.
+GRAPH/BAR=MEAN **.
+GRAPH/BAR=MEAN(**).
+GRAPH/BAR=MEAN(x**).
+GRAPH/BAR=MEAN(x) **.
+GRAPH/BAR=MEAN(x) BY **.
+GRAPH/BAR=MEAN(x) BY y BY **.
+GRAPH/HISTOGRAM=x/SCATTERPLOT=y.
+GRAPH/SCATTERPLOT(OVERLAY).
+GRAPH/SCATTERPLOT(MATRIX).
+GRAPH/SCATTERPLOT(XYZ).
+GRAPH/SCATTERPLOT(**).
+GRAPH/SCATTERPLOT(BIVARIATE **).
+GRAPH/SCATTERPLOT **.
+GRAPH/SCATTERPLOT=**.
+GRAPH/SCATTERPLOT=x y z.
+GRAPH/SCATTERPLOT=x **.
+GRAPH/SCATTERPLOT=x WITH **.
+GRAPH/SCATTERPLOT=x WITH y z.
+GRAPH/SCATTERPLOT=x WITH y BY **.
+GRAPH/LINE.
+GRAPH/PIE.
+GRAPH/ERRORBAR.
+GRAPH/PARETO.
+GRAPH/TITLE.
+GRAPH/SUBTITLE.
+GRAPH/FOOTNOTE.
+GRAPH/MISSING=**.
+GRAPH/ **.
+])
+AT_CHECK([pspp -O format=csv graph.sps], [1], [dnl
+"graph.sps:2.19-2.27: error: GRAPH: Only one chart type is allowed.
+    2 | GRAPH/HISTOGRAM=x/HISTOGRAM=y.
+      |                   ^~~~~~~~~"
+
+"graph.sps:3.17-3.18: error: GRAPH: Syntax error expecting `NORMAL)'.
+    3 | GRAPH/HISTOGRAM(**).
+      |                 ^~"
+
+"graph.sps:4.17-4.25: error: GRAPH: Syntax error expecting `NORMAL)'.
+    4 | GRAPH/HISTOGRAM(NORMAL **).
+      |                 ^~~~~~~~~"
+
+"graph.sps:5.17-5.18: error: GRAPH: Syntax error expecting variable name.
+    5 | GRAPH/HISTOGRAM=**.
+      |                 ^~"
+
+"graph.sps:6.17-6.21: error: GRAPH: Only one variable is allowed.
+    6 | GRAPH/HISTOGRAM=x y z.
+      |                 ^~~~~"
+
+"graph.sps:7.19-7.21: error: GRAPH: Only one chart type is allowed.
+    7 | GRAPH/HISTOGRAM=x/BAR=y.
+      |                   ^~~"
+
+"graph.sps:8.11-8.17: error: GRAPH: GROUPED is not yet implemented.
+    8 | GRAPH/BAR(GROUPED).
+      |           ^~~~~~~"
+
+"graph.sps:9.11-9.17: error: GRAPH: STACKED is not yet implemented.
+    9 | GRAPH/BAR(STACKED).
+      |           ^~~~~~~"
+
+"graph.sps:10.11-10.15: error: GRAPH: RANGE is not yet implemented.
+   10 | GRAPH/BAR(RANGE).
+      |           ^~~~~"
+
+"graph.sps:11.11-11.12: error: GRAPH: Syntax error expecting SIMPLE, GROUPED, STACKED, or RANGE.
+   11 | GRAPH/BAR(**).
+      |           ^~"
+
+"graph.sps:12.11-12.12: error: GRAPH: Syntax error expecting `='.
+   12 | GRAPH/BAR **.
+      |           ^~"
+
+"graph.sps:13.11-13.12: error: GRAPH: Syntax error expecting COUNT, PCT, CUFREQ, CUPCT, MEAN, SUM, MAXIMUM, or MINIMUM.
+   13 | GRAPH/BAR=**.
+      |           ^~"
+
+"graph.sps:14.16-14.17: error: GRAPH: Syntax error expecting `('.
+   14 | GRAPH/BAR=MEAN **.
+      |                ^~"
+
+"graph.sps:15.16-15.17: error: GRAPH: Syntax error expecting variable name.
+   15 | GRAPH/BAR=MEAN(**).
+      |                ^~"
+
+"graph.sps:16.17-16.18: error: GRAPH: Syntax error expecting `)'.
+   16 | GRAPH/BAR=MEAN(x**).
+      |                 ^~"
+
+"graph.sps:17.19-17.20: error: GRAPH: Syntax error expecting `BY'.
+   17 | GRAPH/BAR=MEAN(x) **.
+      |                   ^~"
+
+"graph.sps:18.22-18.23: error: GRAPH: Syntax error expecting variable name.
+   18 | GRAPH/BAR=MEAN(x) BY **.
+      |                      ^~"
+
+"graph.sps:19.27-19.28: error: GRAPH: Syntax error expecting variable name.
+   19 | GRAPH/BAR=MEAN(x) BY y BY **.
+      |                           ^~"
+
+"graph.sps:20.19-20.29: error: GRAPH: Only one chart type is allowed.
+   20 | GRAPH/HISTOGRAM=x/SCATTERPLOT=y.
+      |                   ^~~~~~~~~~~"
+
+"graph.sps:21.19-21.25: error: GRAPH: OVERLAY is not yet implemented.
+   21 | GRAPH/SCATTERPLOT(OVERLAY).
+      |                   ^~~~~~~"
+
+"graph.sps:22.19-22.24: error: GRAPH: MATRIX is not yet implemented.
+   22 | GRAPH/SCATTERPLOT(MATRIX).
+      |                   ^~~~~~"
+
+"graph.sps:23.19-23.21: error: GRAPH: XYZ is not yet implemented.
+   23 | GRAPH/SCATTERPLOT(XYZ).
+      |                   ^~~"
+
+"graph.sps:24.19-24.20: error: GRAPH: Syntax error expecting BIVARIATE, OVERLAY, MATRIX, or XYZ.
+   24 | GRAPH/SCATTERPLOT(**).
+      |                   ^~"
+
+"graph.sps:25.29-25.30: error: GRAPH: Syntax error expecting `)'.
+   25 | GRAPH/SCATTERPLOT(BIVARIATE **).
+      |                             ^~"
+
+"graph.sps:26.19-26.20: error: GRAPH: Syntax error expecting `='.
+   26 | GRAPH/SCATTERPLOT **.
+      |                   ^~"
+
+"graph.sps:27.19-27.20: error: GRAPH: Syntax error expecting variable name.
+   27 | GRAPH/SCATTERPLOT=**.
+      |                   ^~"
+
+"graph.sps:28.19-28.23: error: GRAPH: Only one variable is allowed.
+   28 | GRAPH/SCATTERPLOT=x y z.
+      |                   ^~~~~"
+
+"graph.sps:29.21-29.22: error: GRAPH: Syntax error expecting `WITH'.
+   29 | GRAPH/SCATTERPLOT=x **.
+      |                     ^~"
+
+"graph.sps:30.26-30.27: error: GRAPH: Syntax error expecting variable name.
+   30 | GRAPH/SCATTERPLOT=x WITH **.
+      |                          ^~"
+
+"graph.sps:31.26-31.28: error: GRAPH: Only one variable is allowed.
+   31 | GRAPH/SCATTERPLOT=x WITH y z.
+      |                          ^~~"
+
+"graph.sps:32.31-32.32: error: GRAPH: Syntax error expecting variable name.
+   32 | GRAPH/SCATTERPLOT=x WITH y BY **.
+      |                               ^~"
+
+"graph.sps:33.7-33.10: error: GRAPH: LINE is not yet implemented.
+   33 | GRAPH/LINE.
+      |       ^~~~"
+
+"graph.sps:34.7-34.9: error: GRAPH: PIE is not yet implemented.
+   34 | GRAPH/PIE.
+      |       ^~~"
+
+"graph.sps:35.7-35.14: error: GRAPH: ERRORBAR is not yet implemented.
+   35 | GRAPH/ERRORBAR.
+      |       ^~~~~~~~"
+
+"graph.sps:36.7-36.12: error: GRAPH: PARETO is not yet implemented.
+   36 | GRAPH/PARETO.
+      |       ^~~~~~"
+
+"graph.sps:37.7-37.11: error: GRAPH: TITLE is not yet implemented.
+   37 | GRAPH/TITLE.
+      |       ^~~~~"
+
+"graph.sps:38.7-38.14: error: GRAPH: SUBTITLE is not yet implemented.
+   38 | GRAPH/SUBTITLE.
+      |       ^~~~~~~~"
+
+"graph.sps:39.7-39.14: error: GRAPH: FOOTNOTE is not yet implemented.
+   39 | GRAPH/FOOTNOTE.
+      |       ^~~~~~~~"
+
+"graph.sps:40.15-40.16: error: GRAPH: Syntax error expecting LISTWISE, VARIABLE, EXCLUDE, INCLUDE, REPORT, or NOREPORT.
+   40 | GRAPH/MISSING=**.
+      |               ^~"
+
+"graph.sps:41.8-41.9: error: GRAPH: Syntax error expecting one of the following: HISTOGRAM, BAR, SCATTERPLOT, LINE, PIE, ERRORBAR, PARETO, TITLE, SUBTITLE, FOOTNOTE, MISSING.
+   41 | GRAPH/ **.
+      |        ^~"
+])
+AT_CLEANUP
\ No newline at end of file