another test
authorBen Pfaff <blp@cs.stanford.edu>
Sat, 5 Jul 2025 18:08:20 +0000 (11:08 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Sat, 5 Jul 2025 18:08:20 +0000 (11:08 -0700)
rust/pspp/src/sys/cooked.rs
rust/pspp/src/sys/testdata/bad_variable_name_in_long_string_value_label.expected

index 84d3123be3a8f70562028786a281688421d7e6bd..7c4299b26eb587909f684987cbd6012086b4f006 100644 (file)
@@ -167,6 +167,12 @@ pub enum Error {
         max_width: u16,
     },
 
+    #[error("Ignoring long string value label for unknown variable {0}.")]
+    UnknownLongStringValueLabelVariable(Identifier),
+
+    #[error("Ignoring long string value label for numeric variable {0}.")]
+    LongStringValueLabelNumericVariable(Identifier),
+
     #[error("Invalid attribute name.  {0}")]
     InvalidAttributeName(IdError),
 
@@ -992,11 +998,15 @@ pub fn decode(
         .flat_map(|record| record.0.into_iter())
     {
         let Some((_, variable)) = dictionary.variables.get_full_mut2(&record.var_name.0) else {
-            warn(dbg!(Error::TBD));
+            warn(Error::UnknownLongStringValueLabelVariable(
+                record.var_name.clone(),
+            ));
             continue;
         };
         let Some(width) = variable.width.as_string_width() else {
-            warn(dbg!(Error::TBD));
+            warn(Error::LongStringValueLabelNumericVariable(
+                record.var_name.clone(),
+            ));
             continue;
         };
         for (mut value, label) in record.labels.into_iter() {
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0f9a086b6ce55705046dbf9a58d2e3f96cd62093 100644 (file)
@@ -0,0 +1,30 @@
+Ignoring long string value label for unknown variable STR9.
+
+Ignoring long string value label for numeric variable NUM1.
+
+╭──────────────────────┬────────────────────────╮
+│       Created        │    01-JAN-2011 20:53:52│
+├──────────────────────┼────────────────────────┤
+│Writer Product        │PSPP synthetic test file│
+├──────────────────────┼────────────────────────┤
+│       Compression    │SAV                     │
+│       Number of Cases│Unknown                 │
+╰──────────────────────┴────────────────────────╯
+
+╭─────────┬─╮
+│Variables│2│
+╰─────────┴─╯
+
+╭─────┬────────┬─────┬─────────────────┬─────┬─────┬─────────┬────────────┬────────────┬──────────────╮
+│     │Position│Label│Measurement Level│ Role│Width│Alignment│Print Format│Write Format│Missing Values│
+├─────┼────────┼─────┼─────────────────┼─────┼─────┼─────────┼────────────┼────────────┼──────────────┤
+│num1 │       1│     │                 │Input│    8│Right    │F8.0        │F8.0        │              │
+│str14│       2│     │Nominal          │Input│   14│Left     │A14         │A14         │              │
+╰─────┴────────┴─────┴─────────────────┴─────┴─────┴─────────┴────────────┴────────────┴──────────────╯
+
+╭─────────────────────────────┬────────────────────────────────────────╮
+│Variable Value               │                                        │
+├─────────────────────────────┼────────────────────────────────────────┤
+│str14          RSTUVWXYZ     │value label for `RSTUVWXYZ'             │
+│               abcdefghijklmn│another value label for `abcdefghijklmn'│
+╰─────────────────────────────┴────────────────────────────────────────╯