Add test for bug fixed recently in recode
[pspp] / src / weight.c
index fd19f8c8978a371ea6f3003dc4a92a6f2eca32f1..7fac10cca7f4af6f193e38bdf616221c350e3300 100644 (file)
@@ -18,7 +18,7 @@
    02111-1307, USA. */
 
 #include <config.h>
-#include <assert.h>
+#include "error.h"
 #include <stdio.h>
 #include "command.h"
 #include "error.h"
@@ -37,8 +37,6 @@ struct weight_trns
 int
 cmd_weight (void)
 {
-  lex_match_id ("WEIGHT");
-
   if (lex_match_id ("OFF"))
     dict_set_weight (default_dict, NULL);
   else
@@ -54,7 +52,7 @@ cmd_weight (void)
          msg (SE, _("The weighting variable must be numeric."));
          return CMD_FAILURE;
        }
-      if (v->name[0] == '#')
+      if (dict_class_from_id (v->name) == DC_SCRATCH)
        {
          msg (SE, _("The weighting variable may not be scratch."));
          return CMD_FAILURE;