.map_err(|e| std::io::Error::new(std::io::ErrorKind::InvalidInput, e))?;
} else if let Some(col) = cmd.strip_prefix("col ") {
self.static_columns.push(col.to_owned());
+ } else {
+ return Err(std::io::Error::new(
+ std::io::ErrorKind::InvalidInput,
+ format!("Unknown command: {cmd}"),
+ ));
}
Ok(())
}
vec!["foo".to_owned()]
);
+ let bad_command = read_config(&b"!no such command"[..]);
+ assert!(bad_command.is_err());
+ assert!(format!("{bad_command:?}").contains("Unknown command"));
+
let bad_num = read_config(&b"!col_threshold foo"[..]);
assert!(bad_num.is_err());
assert!(format!("{bad_num:?}").contains("Parse"));