From: Ben Pfaff Date: Sat, 5 Jul 2025 18:08:20 +0000 (-0700) Subject: another test X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3c12b51a79e484419c8a065f5f9cce3804ccfe0c;p=pspp another test --- diff --git a/rust/pspp/src/sys/cooked.rs b/rust/pspp/src/sys/cooked.rs index 84d3123be3..7c4299b26e 100644 --- a/rust/pspp/src/sys/cooked.rs +++ b/rust/pspp/src/sys/cooked.rs @@ -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() { diff --git a/rust/pspp/src/sys/testdata/bad_variable_name_in_long_string_value_label.expected b/rust/pspp/src/sys/testdata/bad_variable_name_in_long_string_value_label.expected index e69de29bb2..0f9a086b6c 100644 --- a/rust/pspp/src/sys/testdata/bad_variable_name_in_long_string_value_label.expected +++ b/rust/pspp/src/sys/testdata/bad_variable_name_in_long_string_value_label.expected @@ -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'│ +╰─────────────────────────────┴────────────────────────────────────────╯