Skip to content

Commit

Permalink
more unit tests for cli #700
Browse files Browse the repository at this point in the history
  • Loading branch information
o2sh committed Aug 15, 2022
1 parent f94f2e2 commit 89d194f
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,10 +235,25 @@ mod test {
}

#[test]
fn test_fail_config_with_image_protocol_but_no_image() {
fn test_config_with_image_protocol_but_no_image() {
assert!(Config::try_parse_from(&["onefetch", "--image-protocol", "sixel"]).is_err())
}

#[test]
fn test_config_with_color_resolution_but_no_image() {
assert!(Config::try_parse_from(&["onefetch", "--color-resolution", "32"]).is_err())
}

#[test]
fn test_config_with_ascii_colors_but_out_of_bounds() {
assert!(Config::try_parse_from(&["onefetch", "--ascii-colors", "17"]).is_err())
}

#[test]
fn test_config_with_text_colors_but_out_of_bounds() {
assert!(Config::try_parse_from(&["onefetch", "--text-colors", "17"]).is_err())
}

fn get_default_config() -> Config {
Config {
input: PathBuf::from("."),
Expand Down

0 comments on commit 89d194f

Please sign in to comment.