DESCRIPTIVES: Fix bad error message.
authorBen Pfaff <blp@cs.stanford.edu>
Sat, 25 Jun 2022 03:37:04 +0000 (20:37 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Sat, 25 Jun 2022 03:37:04 +0000 (20:37 -0700)
src/language/stats/descriptives.c
tests/language/stats/descriptives.at

index c1cbe6f27923c77593ccf14915d2bd20fa8a789f..160e45610f4057bd28a269d9c1b9a94eda47c073 100644 (file)
@@ -474,8 +474,8 @@ match_statistic (struct lexer *lexer)
         if (lex_match_id (lexer, dsc_info[stat].identifier))
          return stat;
 
-      lex_get (lexer);
       lex_error (lexer, _("expecting statistic name: reverting to default"));
+      lex_get (lexer);
     }
 
   return DSC_NONE;
index 7b4d29662cf8c05bc602c8616fb99cb86c5c3763..8a1c26a7d472af03fa8c2b8efdef2d9f944ea10c 100644 (file)
@@ -442,3 +442,21 @@ Valid N (listwise),40,,,,
 Missing N (listwise),0,,,,
 ])
 AT_CLEANUP
+
+dnl Check for regression for a bad error message that cited the
+dnl token following the bad statistic name.
+AT_SETUP([DESCRIPTIVES -- negative])
+AT_DATA([descriptives.sps], [dnl
+DATA LIST NOTABLE/V0 to V16 1-17.
+BEGIN DATA.
+12128989012389023
+END DATA.
+DESCRIPTIVES ALL/STATISTICS=COUNT MEAN.
+])
+AT_CHECK([pspp descriptives.sps], [1], [dnl
+descriptives.sps:5.29-5.33: error: DESCRIPTIVES: Syntax error at `COUNT':
+expecting statistic name: reverting to default.
+
+descriptives.sps:5.35-5.38: error: DESCRIPTIVES: Syntax error at `MEAN'.
+])
+AT_CLEANUP