Skip to content

Commit

Permalink
add unit test for info_field #700
Browse files Browse the repository at this point in the history
  • Loading branch information
o2sh committed Aug 7, 2022
1 parent 8e0450d commit 45d690a
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/info/info_field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

0 comments on commit 45d690a

Please sign in to comment.