add unit test for info_field
@@ -73,3 +73,32 @@ impl From<&Vec<InfoField>> for InfoFieldOff {
info_field_off
}
}
+
+#[cfg(test)]
+mod test {
+ use super::*;
+
+ #[test]
+ fn test_from_vec_of_info_fields() {
+ let fields_to_hide = vec![InfoField::Version, InfoField::Repo];
+ let info_field_off = InfoFieldOff::from(&fields_to_hide);
+
+ assert!(!info_field_off.git_info);
+ assert!(!info_field_off.project);
+ assert!(!info_field_off.head);
+ assert!(!info_field_off.pending);
+ assert!(!info_field_off.pending);
+ assert!(info_field_off.version);
+ assert!(!info_field_off.created);
+ assert!(!info_field_off.languages);
+ assert!(!info_field_off.dependencies);
+ assert!(!info_field_off.authors);
+ assert!(!info_field_off.last_change);
+ assert!(!info_field_off.contributors);
+ assert!(info_field_off.repo);
+ assert!(!info_field_off.commits);
+ assert!(!info_field_off.lines_of_code);
+ assert!(!info_field_off.size);
+ assert!(!info_field_off.license);
+ }
+}
