@@ 15,9 15,9 @@ mod sleep_range_type;
#[derive(Parser, Debug)]
#[clap(author, version, about, long_about = None)]
struct Args {
- /// Path of the config file
#[clap(short, long)]
config_path: String,
+ // TODO: add command, choices, sleep range
}
#[derive(Debug, PartialEq, Serialize, Deserialize)]
@@ 77,3 77,20 @@ fn main() {
});
}
}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn cfg_from_yaml() {
+ let maybe_config =
+ Config::from_yaml::<&str, serde_yaml::Error>("./fixtures/sample.yml").ok();
+ assert!(maybe_config.is_some());
+ let config = maybe_config.unwrap();
+ assert_eq!(config.sleep.min, 3);
+ assert_eq!(config.sleep.max, 15);
+ assert_eq!(config.choices.len(), 7);
+ assert_eq!(config.choices[0].name, "Who wrote the Declaration of Independence?");
+ }
+}