From 3d859a4d0fc88efa2f2bd946f621799ef73739bd Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Fri, 24 Jun 2022 20:37:04 -0700 Subject: [PATCH] DESCRIPTIVES: Fix bad error message. --- src/language/stats/descriptives.c | 2 +- tests/language/stats/descriptives.at | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/language/stats/descriptives.c b/src/language/stats/descriptives.c index c1cbe6f279..160e45610f 100644 --- a/src/language/stats/descriptives.c +++ b/src/language/stats/descriptives.c @@ -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; diff --git a/tests/language/stats/descriptives.at b/tests/language/stats/descriptives.at index 7b4d29662c..8a1c26a7d4 100644 --- a/tests/language/stats/descriptives.at +++ b/tests/language/stats/descriptives.at @@ -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 -- 2.30.2