MRSETS: Improve error messages.
authorBen Pfaff <blp@cs.stanford.edu>
Fri, 11 Nov 2022 05:48:34 +0000 (21:48 -0800)
committerBen Pfaff <blp@cs.stanford.edu>
Fri, 11 Nov 2022 05:48:34 +0000 (21:48 -0800)
src/language/dictionary/mrsets.c
tests/language/dictionary/mrsets.at

index 9c91ba9861f5aebcb00b0689bbbf34fe8bc8a2e7..fbcd1da215a46ec80bbe4baa76c5468a4fd3eeb3 100644 (file)
@@ -64,7 +64,8 @@ cmd_mrsets (struct lexer *lexer, struct dataset *ds)
       else
         {
           ok = false;
-          lex_error (lexer, NULL);
+          lex_error_expecting (lexer, "MDGROUP", "MCGROUP",
+                               "DELETE", "DISPLAY");
         }
 
       if (!ok)
@@ -128,9 +129,7 @@ parse_group (struct lexer *lexer, struct dictionary *dict,
           if (mrset->n_vars < 2)
             {
               lex_ofs_error (lexer, vars_start, vars_end,
-                             _("VARIABLES specified only variable %s on %s, but "
-                               "at least two variables are required."),
-                   var_get_name (mrset->vars[0]), subcommand_name);
+                             _("At least two variables are required."));
               goto error;
             }
         }
@@ -195,7 +194,7 @@ parse_group (struct lexer *lexer, struct dictionary *dict,
             }
           else
             {
-              lex_error (lexer, NULL);
+              lex_error (lexer, _("Syntax error expecting integer or string."));
               goto error;
             }
           lex_get (lexer);
@@ -211,13 +210,17 @@ parse_group (struct lexer *lexer, struct dictionary *dict,
             mrset->cat_source = MRSET_COUNTEDVALUES;
           else
             {
-              lex_error (lexer, NULL);
+              lex_error_expecting (lexer, "VARLABELS", "COUNTEDVALUES");
               goto error;
             }
         }
       else
         {
-          lex_error (lexer, NULL);
+          if (type == MRSET_MD)
+            lex_error_expecting (lexer, "NAME", "VARIABLES", "LABEL",
+                                 "LABELSOURCE", "VALUE", "CATEGORYLABELS");
+          else
+            lex_error_expecting (lexer, "NAME", "VARIABLES", "LABEL");
           goto error;
         }
     }
@@ -241,56 +244,48 @@ parse_group (struct lexer *lexer, struct dictionary *dict,
           lex_spec_missing (lexer, subcommand_name, "VALUE");
           goto error;
         }
-      else if (var_is_alpha (mrset->vars[0]))
+
+      if (var_is_alpha (mrset->vars[0]) != (mrset->width > 0))
         {
-          if (mrset->width == 0)
-            {
-              lex_ofs_error (lexer, value_ofs, value_ofs,
-                             _("MDGROUP subcommand for group %s specifies a "
-                               "string VALUE, but the variables specified for "
-                               "this group are numeric."),
-                             mrset->name);
-              goto error;
-            }
-          else {
-            const struct variable *shortest_var;
-            int min_width;
-            size_t i;
-
-            shortest_var = NULL;
-            min_width = INT_MAX;
-            for (i = 0; i < mrset->n_vars; i++)
-              {
-                int width = var_get_width (mrset->vars[i]);
-                if (width < min_width)
-                  {
-                    shortest_var = mrset->vars[i];
-                    min_width = width;
-                  }
-              }
-            if (mrset->width > min_width)
-              {
-                lex_ofs_error (lexer, value_ofs, value_ofs,
-                               _("VALUE string on MDGROUP subcommand for "
-                                 "group %s is %d bytes long, but it must be "
-                                 "no longer than the narrowest variable in "
-                                 "the group, which is %s with a width of "
-                                 "%d bytes."),
-                               mrset->name, mrset->width,
-                               var_get_name (shortest_var), min_width);
-                goto error;
-              }
-          }
+          msg (SE, _("VARIABLES and VALUE must have the same type."));
+          if (var_is_alpha (mrset->vars[0]))
+            lex_ofs_msg (lexer, SN, vars_start, vars_end,
+                         _("These are string variables."));
+          else
+            lex_ofs_msg (lexer, SN, vars_start, vars_end,
+                         _("These are numeric variables."));
+          if (mrset->width > 0)
+            lex_ofs_msg (lexer, SN, value_ofs, value_ofs,
+                         _("This is a string value."));
+          else
+            lex_ofs_msg (lexer, SN, value_ofs, value_ofs,
+                         _("This is a numeric value."));
+          goto error;
         }
-      else
+      if (var_is_alpha (mrset->vars[0]))
         {
-          if (mrset->width != 0)
+          const struct variable *shortest_var = NULL;
+          int min_width = INT_MAX;
+
+          for (size_t i = 0; i < mrset->n_vars; i++)
             {
-              lex_ofs_error (lexer, value_ofs, value_ofs,
-                             _("MDGROUP subcommand for group %s specifies a "
-                               "string VALUE, but the variables specified for "
-                               "this group are numeric."),
-                   mrset->name);
+              int width = var_get_width (mrset->vars[i]);
+              if (width < min_width)
+                {
+                  shortest_var = mrset->vars[i];
+                  min_width = width;
+                }
+            }
+          if (mrset->width > min_width)
+            {
+              msg (SE, _("The VALUE string must be no longer than the "
+                         "narrowest variable in the group."));
+              lex_ofs_msg (lexer, SN, value_ofs, value_ofs,
+                           _("The VALUE string is %d bytes long."),
+                           mrset->width);
+              lex_ofs_msg (lexer, SN, vars_start, vars_end,
+                           _("Variable %s has a width of %d bytes."),
+                           var_get_name (shortest_var), min_width);
               goto error;
             }
         }
@@ -319,10 +314,8 @@ parse_group (struct lexer *lexer, struct dictionary *dict,
             }
           else
             {
-              size_t i;
-
               mrset->label_from_var_label = true;
-              for (i = 0; mrset->label == NULL && i < mrset->n_vars; i++)
+              for (size_t i = 0; mrset->label == NULL && i < mrset->n_vars; i++)
                 {
                   const char *label = var_get_label (mrset->vars[i]);
                   if (label != NULL)
@@ -366,23 +359,18 @@ parse_group (struct lexer *lexer, struct dictionary *dict,
         }
       else
         {
-          struct stringi_map seen;
-          size_t i;
-
-          stringi_map_init (&seen);
-          for (i = 0; i < mrset->n_vars; i++)
+          struct stringi_map seen = STRINGI_MAP_INITIALIZER (seen);
+          for (size_t i = 0; i < mrset->n_vars; i++)
             {
               const struct variable *var = mrset->vars[i];
               const char *name = var_get_name (var);
-              const struct val_labs *val_labs;
-              union value value;
-              const char *label;
 
+              union value value;
               value_clone (&value, &mrset->counted, mrset->width);
               value_resize (&value, mrset->width, var_get_width (var));
 
-              val_labs = var_get_value_labels (var);
-              label = val_labs_find (val_labs, &value);
+              const struct val_labs *val_labs = var_get_value_labels (var);
+              const char *label = val_labs_find (val_labs, &value);
               if (label == NULL)
                 lex_ofs_msg (lexer, SW, vars_start, vars_end,
                              _("Variable %s specified as part of multiple "
@@ -407,6 +395,8 @@ parse_group (struct lexer *lexer, struct dictionary *dict,
                                    "distinguishable in output."),
                                  other_name, name, mrset->name);
                 }
+
+              value_destroy (&value, var_get_width (var));
             }
           stringi_map_destroy (&seen);
         }
@@ -424,20 +414,15 @@ parse_group (struct lexer *lexer, struct dictionary *dict,
           bool warned;
         };
 
-      struct category *c, *next;
-      struct hmap categories;
-      size_t i;
-
-      hmap_init (&categories);
-      for (i = 0; i < mrset->n_vars; i++)
+      struct hmap categories = HMAP_INITIALIZER (categories);
+      for (size_t i = 0; i < mrset->n_vars; i++)
         {
           const struct variable *var = mrset->vars[i];
           const char *name = var_get_name (var);
           int width = var_get_width (var);
-          const struct val_labs *val_labs;
-          const struct val_lab *vl;
+          const struct val_labs *val_labs = var_get_value_labels (var);
 
-          val_labs = var_get_value_labels (var);
+          const struct val_lab *vl;
           for (vl = val_labs_first (val_labs); vl != NULL;
                vl = val_labs_next (val_labs, vl))
             {
@@ -445,6 +430,7 @@ parse_group (struct lexer *lexer, struct dictionary *dict,
               const char *label = val_lab_get_label (vl);
               unsigned int hash = value_hash (value, width, 0);
 
+              struct category *c;
               HMAP_FOR_EACH_WITH_HASH (c, struct category, hmap_node,
                                        hash, &categories)
                 {
@@ -471,17 +457,20 @@ parse_group (struct lexer *lexer, struct dictionary *dict,
                 }
 
               c = xmalloc (sizeof *c);
+              *c = (struct category) {
+                .width = width,
+                .label = label,
+                .var_name = name,
+                .warned = false,
+              };
               value_clone (&c->value, value, width);
-              c->width = width;
-              c->label = label;
-              c->var_name = name;
-              c->warned = false;
               hmap_insert (&categories, &c->hmap_node, hash);
 
             found: ;
             }
         }
 
+      struct category *c, *next;
       HMAP_FOR_EACH_SAFE (c, next, struct category, hmap_node, &categories)
         {
           value_destroy (&c->value, c->width);
@@ -532,6 +521,11 @@ parse_mrset_names (struct lexer *lexer, struct dictionary *dict,
       for (i = 0; i < n_sets; i++)
         stringi_set_insert (mrset_names, dict_get_mrset (dict, i)->name);
     }
+  else
+    {
+      lex_error_expecting (lexer, "`['", "ALL");
+      return false;
+    }
 
   return true;
 }
@@ -539,13 +533,12 @@ parse_mrset_names (struct lexer *lexer, struct dictionary *dict,
 static bool
 parse_delete (struct lexer *lexer, struct dictionary *dict)
 {
-  const struct stringi_set_node *node;
   struct stringi_set mrset_names;
   const char *name;
-
   if (!parse_mrset_names (lexer, dict, &mrset_names))
     return false;
 
+  const struct stringi_set_node *node;
   STRINGI_SET_FOR_EACH (name, node, &mrset_names)
     dict_delete_mrset (dict, name);
   stringi_set_destroy (&mrset_names);
index f8f21a4c1c78733f75a49e84b8e0cf222979a720..c805b64455f8ff99d8f2697ad2a5f4659550efc8 100644 (file)
@@ -211,137 +211,219 @@ AT_CHECK([pspp -O format=csv mrsets2.sps], [0], [MRSETS_DISPLAY_OUTPUT],
   [], [hd mrsets.sav])
 AT_CLEANUP
 
-AT_SETUP([MRSETS names must begin with $])
-AT_DATA([mrsets.sps],
-  [DEFINE_MRSETS_DATA
-MRSETS /MCGROUP NAME=x.
+AT_SETUP([MRSETS syntax errors])
+AT_DATA([mrsets.sps], [dnl
+DATA LIST NOTABLE /w x y z 1-4 a b c d 5-8 (a).
+BEGIN DATA.
+1234acbd
+5678efgh
+END DATA.
+VARIABLE LABEL
+    w 'duplicate variable label'
+    x 'Variable x'
+    z 'Duplicate variable label'.
+VALUE LABELS
+    /w 1 'w value 1'
+    /y 1 'duplicate Value label'
+    /z 1 'duplicate value Label'
+    /a b c d 'a' 'burger' 'b' 'fries' 'c' 'shake' 'd' 'taco'.
+ADD VALUE LABELS
+    /b 'b' 'Fries'
+    /c 'b' 'XXX'.
+
+MRSETS /MDGROUP NAME **.
+MRSETS /MDGROUP NAME=**.
+MRSETS /MDGROUP NAME=x.
+MRSETS /MDGROUP VARIABLES **.
+MRSETS /MDGROUP VARIABLES=**.
+MRSETS /MDGROUP VARIABLES=a.
+MRSETS /MDGROUP LABEL **.
+MRSETS /MDGROUP LABEL=**.
+MRSETS /MDGROUP LABELSOURCE=**.
+MRSETS /MDGROUP VALUE **.
+MRSETS /MDGROUP VALUE=1.5.
+MRSETS /MDGROUP VALUE=**.
+MRSETS /MDGROUP CATEGORYLABELS **.
+MRSETS /MDGROUP CATEGORYLABELS=**.
+MRSETS /MDGROUP **.
+MRSETS /MCGROUP **.
+MRSETS /MDGROUP.
+MRSETS /MDGROUP NAME=[$x].
+MRSETS /MDGROUP NAME=[$x] VARIABLES=a b VALUE=1.
+MRSETS /MDGROUP NAME=[$x] VARIABLES=x y VALUE='a'.
+MRSETS /MDGROUP NAME=[$x] VARIABLES=a b VALUE='xyzzy'.
+MRSETS /MDGROUP NAME=[$x] VARIABLES=a b VALUE='y' LABELSOURCE=VARLABEL.
+MRSETS /MDGROUP NAME=[$x] VARIABLES=w z VALUE=1 CATEGORYLABELS=VARLABELS.
+MRSETS /MDGROUP NAME=[$x] VARIABLES=a b VALUE='y'
+  LABELSOURCE=VARLABEL CATEGORYLABELS=COUNTEDVALUES
+  LABEL='foo'.
+MRSETS /MDGROUP NAME=[$x] VARIABLES=y z VALUE=1
+  LABELSOURCE=VARLABEL CATEGORYLABELS=COUNTEDVALUES.
+MRSETS /MCGROUP NAME=[$x] VARIABLES=w x y z.
+
+MRSETS /DELETE **.
+MRSETS /DELETE NAME**.
+MRSETS /DELETE NAME=[[**]].
+MRSETS /DELETE NAME=[[$x]].
+MRSETS /DELETE NAME=**.
+
+MRSETS /DISPLAY NAME=ALL.
 ])
 AT_CHECK([pspp -O format=csv mrsets.sps], [1], [dnl
-"mrsets.sps:6.22: error: MRSETS: x is not a valid name for a multiple response set.  Multiple response set names must begin with `$'.
-    6 | MRSETS /MCGROUP NAME=x.
+"mrsets.sps:19.22-19.23: error: MRSETS: Syntax error expecting `='.
+   19 | MRSETS /MDGROUP NAME **.
+      |                      ^~"
+
+"mrsets.sps:20.22-20.23: error: MRSETS: Syntax error expecting identifier.
+   20 | MRSETS /MDGROUP NAME=**.
+      |                      ^~"
+
+"mrsets.sps:21.22: error: MRSETS: x is not a valid name for a multiple response set.  Multiple response set names must begin with `$'.
+   21 | MRSETS /MDGROUP NAME=x.
       |                      ^"
-])
-AT_CLEANUP
 
-AT_SETUP([MRSETS must have at least 2 variables])
-AT_DATA([mrsets.sps],
-  [DEFINE_MRSETS_DATA
-MRSETS /MCGROUP NAME=$x VARIABLES=a.
-])
-AT_CHECK([pspp -O format=csv mrsets.sps], [1], [dnl
-"mrsets.sps:6.35: error: MRSETS: VARIABLES specified only variable a on MCGROUP, but at least two variables are required.
-    6 | MRSETS /MCGROUP NAME=$x VARIABLES=a.
-      |                                   ^"
-])
-AT_CLEANUP
+"mrsets.sps:22.27-22.28: error: MRSETS: Syntax error expecting `='.
+   22 | MRSETS /MDGROUP VARIABLES **.
+      |                           ^~"
 
-AT_SETUP([MRSETS does not allow noninteger VALUE])
-AT_DATA([mrsets.sps],
-  [DEFINE_MRSETS_DATA
-MRSETS /MDGROUP VALUE=1.5.
-])
-AT_CHECK([pspp -O format=csv mrsets.sps], [1], [dnl
-"mrsets.sps:6.23-6.25: error: MRSETS: Numeric VALUE must be an integer.
-    6 | MRSETS /MDGROUP VALUE=1.5.
+"mrsets.sps:23.27-23.28: error: MRSETS: Syntax error expecting variable name.
+   23 | MRSETS /MDGROUP VARIABLES=**.
+      |                           ^~"
+
+"mrsets.sps:24.27: error: MRSETS: At least two variables are required.
+   24 | MRSETS /MDGROUP VARIABLES=a.
+      |                           ^"
+
+"mrsets.sps:25.23-25.24: error: MRSETS: Syntax error expecting `='.
+   25 | MRSETS /MDGROUP LABEL **.
+      |                       ^~"
+
+"mrsets.sps:26.23-26.24: error: MRSETS: Syntax error expecting string.
+   26 | MRSETS /MDGROUP LABEL=**.
+      |                       ^~"
+
+"mrsets.sps:27.28-27.30: error: MRSETS: Syntax error expecting `=VARLABEL'.
+   27 | MRSETS /MDGROUP LABELSOURCE=**.
+      |                            ^~~"
+
+"mrsets.sps:28.23-28.24: error: MRSETS: Syntax error expecting `='.
+   28 | MRSETS /MDGROUP VALUE **.
+      |                       ^~"
+
+"mrsets.sps:29.23-29.25: error: MRSETS: Numeric VALUE must be an integer.
+   29 | MRSETS /MDGROUP VALUE=1.5.
       |                       ^~~"
-])
-AT_CLEANUP
 
-AT_SETUP([MRSETS requires NAME to define a group])
-AT_DATA([mrsets.sps],
-  [DEFINE_MRSETS_DATA
-MRSETS /MCGROUP VARIABLES=a b c.
-])
-AT_CHECK([pspp -O format=csv mrsets.sps], [1], [dnl
-"mrsets.sps:6.32: error: MRSETS: Required NAME specification missing from MCGROUP subcommand.
-    6 | MRSETS /MCGROUP VARIABLES=a b c.
-      |                                ^"
-])
-AT_CLEANUP
+"mrsets.sps:30.23-30.24: error: MRSETS: Syntax error expecting integer or string.
+   30 | MRSETS /MDGROUP VALUE=**.
+      |                       ^~"
 
-AT_SETUP([MRSETS requires VARIABLES to define a group])
-AT_DATA([mrsets.sps],
-  [DEFINE_MRSETS_DATA
-MRSETS /MCGROUP NAME=$Mcgroup.
-])
-AT_CHECK([pspp -O format=csv mrsets.sps], [1], [dnl
-"mrsets.sps:6.30: error: MRSETS: Required VARIABLES specification missing from MCGROUP subcommand.
-    6 | MRSETS /MCGROUP NAME=$Mcgroup.
-      |                              ^"
-])
-AT_CLEANUP
+"mrsets.sps:31.32-31.33: error: MRSETS: Syntax error expecting `='.
+   31 | MRSETS /MDGROUP CATEGORYLABELS **.
+      |                                ^~"
 
-AT_SETUP([MRSETS variables must be same type])
-AT_DATA([mrsets.sps],
-  [DEFINE_MRSETS_DATA
-MRSETS /MCGROUP NAME=$mygroup VARIABLES=a b x y.
-])
-AT_CHECK([pspp -O format=csv mrsets.sps], [1], [dnl
-"mrsets.sps:6.45: error: MRSETS: a and x are not the same type.  All variables in this variable list must be of the same type.  x will be omitted from the list.
-    6 | MRSETS /MCGROUP NAME=$mygroup VARIABLES=a b x y.
+"mrsets.sps:32.32-32.33: error: MRSETS: Syntax error expecting VARLABELS or COUNTEDVALUES.
+   32 | MRSETS /MDGROUP CATEGORYLABELS=**.
+      |                                ^~"
+
+"mrsets.sps:33.17-33.18: error: MRSETS: Syntax error expecting NAME, VARIABLES, LABEL, LABELSOURCE, VALUE, or CATEGORYLABELS.
+   33 | MRSETS /MDGROUP **.
+      |                 ^~"
+
+"mrsets.sps:34.17-34.18: error: MRSETS: Syntax error expecting NAME, VARIABLES, or LABEL.
+   34 | MRSETS /MCGROUP **.
+      |                 ^~"
+
+"mrsets.sps:35.16: error: MRSETS: Required NAME specification missing from MDGROUP subcommand.
+   35 | MRSETS /MDGROUP.
+      |                ^"
+
+"mrsets.sps:36.24: error: MRSETS: Required VARIABLES specification missing from MDGROUP subcommand.
+   36 | MRSETS /MDGROUP NAME=$x.
+      |                        ^"
+
+mrsets.sps:37: error: MRSETS: VARIABLES and VALUE must have the same type.
+
+"mrsets.sps:37.35-37.37: note: MRSETS: These are string variables.
+   37 | MRSETS /MDGROUP NAME=$x VARIABLES=a b VALUE=1.
+      |                                   ^~~"
+
+"mrsets.sps:37.45: note: MRSETS: This is a numeric value.
+   37 | MRSETS /MDGROUP NAME=$x VARIABLES=a b VALUE=1.
       |                                             ^"
 
-"mrsets.sps:6.47: error: MRSETS: a and y are not the same type.  All variables in this variable list must be of the same type.  y will be omitted from the list.
-    6 | MRSETS /MCGROUP NAME=$mygroup VARIABLES=a b x y.
-      |                                               ^"
-])
-AT_CLEANUP
+mrsets.sps:38: error: MRSETS: VARIABLES and VALUE must have the same type.
 
-AT_SETUP([MRSETS variables and VALUE must be same type])
-AT_DATA([mrsets.sps],
-  [DEFINE_MRSETS_DATA
-MRSETS /MDGROUP NAME=$group1 VARIABLES=a b VALUE=1.
-MRSETS /MDGROUP NAME=$group2 VARIABLES=x y VALUE='abc'.
-])
-AT_CHECK([pspp -O format=csv mrsets.sps], [1], [dnl
-"mrsets.sps:6.50: error: MRSETS: MDGROUP subcommand for group $group1 specifies a string VALUE, but the variables specified for this group are numeric.
-    6 | MRSETS /MDGROUP NAME=$group1 VARIABLES=a b VALUE=1.
-      |                                                  ^"
+"mrsets.sps:38.35-38.37: note: MRSETS: These are numeric variables.
+   38 | MRSETS /MDGROUP NAME=$x VARIABLES=x y VALUE='a'.
+      |                                   ^~~"
 
-"mrsets.sps:7.50-7.54: error: MRSETS: MDGROUP subcommand for group $group2 specifies a string VALUE, but the variables specified for this group are numeric.
-    7 | MRSETS /MDGROUP NAME=$group2 VARIABLES=x y VALUE='abc'.
-      |                                                  ^~~~~"
-])
-AT_CLEANUP
+"mrsets.sps:38.45-38.47: note: MRSETS: This is a string value.
+   38 | MRSETS /MDGROUP NAME=$x VARIABLES=x y VALUE='a'.
+      |                                             ^~~"
 
-AT_SETUP([MRSETS VALUE must not be too wide])
-AT_DATA([mrsets.sps],
-  [DEFINE_MRSETS_DATA
-MRSETS /MDGROUP NAME=$group1 VARIABLES=a b VALUE='abc'.
-])
-AT_CHECK([pspp -O format=csv mrsets.sps], [1], [dnl
-"mrsets.sps:6.50-6.54: error: MRSETS: VALUE string on MDGROUP subcommand for group $group1 is 3 bytes long, but it must be no longer than the narrowest variable in the group, which is a with a width of 1 bytes.
-    6 | MRSETS /MDGROUP NAME=$group1 VARIABLES=a b VALUE='abc'.
-      |                                                  ^~~~~"
-])
-AT_CLEANUP
+mrsets.sps:39: error: MRSETS: The VALUE string must be no longer than the narrowest variable in the group.
 
-AT_SETUP([MRSETS LABEL and LABELSOURCE are exclusive])
-AT_DATA([mrsets.sps],
-  [DEFINE_MRSETS_DATA
-MRSETS /MDGROUP NAME=$group1 VARIABLES=a b VALUE='a'
-                LABEL='label' LABELSOURCE=VARLABEL.
-])
-AT_CHECK([pspp -O format=csv mrsets.sps], [0], [dnl
-"mrsets.sps:7.31-7.50: warning: MRSETS: MDGROUP subcommand for group $group1 specifies LABELSOURCE=VARLABEL but not CATEGORYLABELS=COUNTEDVALUES.  Ignoring LABELSOURCE.
-    7 |                 LABEL='label' LABELSOURCE=VARLABEL.
-      |                               ^~~~~~~~~~~~~~~~~~~~"
-])
-AT_CLEANUP
+"mrsets.sps:39.45-39.51: note: MRSETS: The VALUE string is 5 bytes long.
+   39 | MRSETS /MDGROUP NAME=$x VARIABLES=a b VALUE='xyzzy'.
+      |                                             ^~~~~~~"
 
-AT_SETUP([MRSETS DISPLAY or DELETE unknown group])
-AT_DATA([mrsets.sps],
-  [DEFINE_MRSETS_DATA
-[MRSETS /DISPLAY NAME=[$x].
-MRSETS /DELETE NAME=[$y].
-]])
-AT_CHECK([pspp -O format=csv mrsets.sps], [1], [dnl
-"mrsets.sps:6.23-6.24: error: MRSETS: No multiple response set named $x.
-    6 | MRSETS /DISPLAY NAME=[[$x]].
-      |                       ^~"
+"mrsets.sps:39.35-39.37: note: MRSETS: Variable a has a width of 1 bytes.
+   39 | MRSETS /MDGROUP NAME=$x VARIABLES=a b VALUE='xyzzy'.
+      |                                   ^~~"
 
-"mrsets.sps:7.22-7.23: error: MRSETS: No multiple response set named $y.
-    7 | MRSETS /DELETE NAME=[[$y]].
+"mrsets.sps:40.49-40.68: warning: MRSETS: MDGROUP subcommand for group $x specifies LABELSOURCE=VARLABEL but not CATEGORYLABELS=COUNTEDVALUES.  Ignoring LABELSOURCE.
+   40 | MRSETS /MDGROUP NAME=$x VARIABLES=a b VALUE='y' LABELSOURCE=VARLABEL.
+      |                                                 ^~~~~~~~~~~~~~~~~~~~"
+
+"mrsets.sps:41.35-41.37: warning: MRSETS: Variables w and z specified as part of multiple dichotomy group $x have the same variable label.  Categories represented by these variables will not be distinguishable in output.
+   41 | MRSETS /MDGROUP NAME=$x VARIABLES=w z VALUE=1 CATEGORYLABELS=VARLABELS.
+      |                                   ^~~"
+
+"mrsets.sps:44: warning: MRSETS: MDGROUP subcommand for group $x specifies both LABEL and LABELSOURCE, but only one of these subcommands may be used at a time.  Ignoring LABELSOURCE."
+
+"mrsets.sps:44.3-44.13: note: MRSETS: Here is the LABEL setting.
+   44 |   LABEL='foo'.
+      |   ^~~~~~~~~~~"
+
+"mrsets.sps:43.3-43.22: note: MRSETS: Here is the LABELSOURCE setting.
+   43 |   LABELSOURCE=VARLABEL CATEGORYLABELS=COUNTEDVALUES
+      |   ^~~~~~~~~~~~~~~~~~~~"
+
+"mrsets.sps:42.35-42.37: warning: MRSETS: Variable a specified as part of multiple dichotomy group $x (which has CATEGORYLABELS=COUNTEDVALUES) has no value label for its counted value.  This category will not be distinguishable in output.
+   42 | MRSETS /MDGROUP NAME=$x VARIABLES=a b VALUE='y'
+      |                                   ^~~"
+
+"mrsets.sps:42.35-42.37: warning: MRSETS: Variable b specified as part of multiple dichotomy group $x (which has CATEGORYLABELS=COUNTEDVALUES) has no value label for its counted value.  This category will not be distinguishable in output.
+   42 | MRSETS /MDGROUP NAME=$x VARIABLES=a b VALUE='y'
+      |                                   ^~~"
+
+"mrsets.sps:45.35-45.37: warning: MRSETS: Variables y and z specified as part of multiple dichotomy group $x (which has CATEGORYLABELS=COUNTEDVALUES) have the same value label for the group's counted value.  These categories will not be distinguishable in output.
+   45 | MRSETS /MDGROUP NAME=$x VARIABLES=y z VALUE=1
+      |                                   ^~~"
+
+"mrsets.sps:47.35-47.41: warning: MRSETS: Variables specified on MCGROUP should have the same categories, but w and y (and possibly others) in multiple category group $x have different value labels for value 1.
+   47 | MRSETS /MCGROUP NAME=$x VARIABLES=w x y z.
+      |                                   ^~~~~~~"
+
+"mrsets.sps:49.16-49.17: error: MRSETS: Syntax error expecting `NAME='.
+   49 | MRSETS /DELETE **.
+      |                ^~"
+
+"mrsets.sps:50.16-50.21: error: MRSETS: Syntax error expecting `NAME='.
+   50 | MRSETS /DELETE NAME**.
+      |                ^~~~~~"
+
+"mrsets.sps:51.22-51.23: error: MRSETS: Syntax error expecting identifier.
+   51 | MRSETS /DELETE NAME=[[**]].
       |                      ^~"
+
+"mrsets.sps:53.21-53.22: error: MRSETS: Syntax error expecting `@<:@' or ALL.
+   53 | MRSETS /DELETE NAME=**.
+      |                     ^~"
+
+"mrsets.sps:55.22-55.24: note: MRSETS: The active dataset dictionary does not contain any multiple response sets.
+   55 | MRSETS /DISPLAY NAME=ALL.
+      |                      ^~~"
 ])
 AT_CLEANUP