use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Default)]
pub enum ImportPreviewChoice {
#[default]
Ask,
Full,
Solid,
Skip,
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn the_default_asks_and_every_variant_round_trips_through_toml() {
assert_eq!(ImportPreviewChoice::default(), ImportPreviewChoice::Ask);
for choice in [
ImportPreviewChoice::Ask,
ImportPreviewChoice::Full,
ImportPreviewChoice::Solid,
ImportPreviewChoice::Skip,
] {
#[derive(Serialize, Deserialize)]
struct Holder {
choice: ImportPreviewChoice,
}
let text = toml::to_string(&Holder { choice }).unwrap();
assert_eq!(toml::from_str::<Holder>(&text).unwrap().choice, choice);
}
}
}