fix me lol

This commit is contained in:
2026-08-29 17:11:55 -05:00
parent 4b7ab4f10a
commit 94a2d4fed6
12 changed files with 1912 additions and 55 deletions
+32 -2
View File
@@ -42,14 +42,44 @@ fn bare_subcommands_are_recognised() {
assert_eq!(parse_args(&args(&["--version"])).unwrap(), Command::Version);
assert_eq!(
parse_args(&args(&["ndi-sources"])).unwrap(),
Command::ListNdiSources { timeout_secs: 5 }
Command::ListNdiSources { timeout_secs: 5, extra_ips: Vec::new() }
);
assert_eq!(
parse_args(&args(&["ndi-sources", "--timeout", "20"])).unwrap(),
Command::ListNdiSources { timeout_secs: 20 }
Command::ListNdiSources { timeout_secs: 20, extra_ips: Vec::new() }
);
}
#[test]
fn ndi_sources_accepts_repeated_unicast_hints() {
assert_eq!(
parse_args(&args(&[
"ndi-sources", "--extra-ip", "10.0.0.5", "--timeout", "8",
"--extra-ip", "ndi.example.test",
]))
.unwrap(),
Command::ListNdiSources {
timeout_secs: 8,
extra_ips: vec!["10.0.0.5".into(), "ndi.example.test".into()],
}
);
assert_eq!(
parse_args(&args(&["ndi-sources", "--timeout", "300"])).unwrap(),
Command::ListNdiSources { timeout_secs: 300, extra_ips: Vec::new() }
);
}
#[test]
fn ndi_sources_rejects_bad_options_and_values() {
assert!(parse_args(&args(&["ndi-sources", "--timeout"])).is_err());
assert!(parse_args(&args(&["ndi-sources", "--timeout", "soon"])).is_err());
assert!(parse_args(&args(&["ndi-sources", "--timeout", "0"])).is_err());
assert!(parse_args(&args(&["ndi-sources", "--timeout", "301"])).is_err());
assert!(parse_args(&args(&["ndi-sources", "--timeout", "18446744073709551615"])).is_err());
assert!(parse_args(&args(&["ndi-sources", "--extra-ip"])).is_err());
assert!(parse_args(&args(&["ndi-sources", "--source", "anything"])).is_err());
}
#[test]
fn no_arguments_is_an_error_with_usage() {
let e = parse_args(&[]).unwrap_err();