From f61c2c828b9d15a2fdf9a7e4b61486cde9e534fb Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Sun, 21 Jul 2019 10:34:23 -0700 Subject: [PATCH] t-test-parser: Force values to be specified with a string vars on GROUPS. --- src/language/stats/t-test-parser.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/language/stats/t-test-parser.c b/src/language/stats/t-test-parser.c index 6850979c61..2544da4c88 100644 --- a/src/language/stats/t-test-parser.c +++ b/src/language/stats/t-test-parser.c @@ -100,15 +100,21 @@ cmd_t_test (struct lexer *lexer, struct dataset *ds) value_init (&gval0, gval_width); value_init (&gval1, gval_width); + int n; if (lex_match (lexer, T_LPAREN)) { parse_value (lexer, &gval0, gvar); - cut = true; if (lex_token (lexer) != T_RPAREN) { lex_match (lexer, T_COMMA); parse_value (lexer, &gval1, gvar); cut = false; + n = 2; + } + else + { + cut = true; + n = 1; } if (! lex_force_match (lexer, T_RPAREN)) @@ -119,9 +125,10 @@ cmd_t_test (struct lexer *lexer, struct dataset *ds) gval0.f = 1.0; gval1.f = 2.0; cut = false; + n = 0; } - if ( cut == true && var_is_alpha (gvar)) + if (n != 2 && var_is_alpha (gvar)) { msg (SE, _("When applying %s to a string variable, two " "values must be specified."), "GROUPS"); -- 2.30.2