refactor: move embedded tests into dedicated test directory

This commit is contained in:
Valdemar Lorenzen
2026-10-16 16:30:07 +02:00
parent de6a57e67d
commit 2772e6878a
55 changed files with 45752 additions and 45858 deletions
+46
View File
@@ -0,0 +1,46 @@
use super::*;
fn parse(args: &[&str]) -> Result<Option<Options>, String> {
parse_options(args.iter().map(std::ffi::OsString::from))
}
#[test]
fn review_commands_preserve_filenames_and_validate_arguments() {
assert_eq!(
parse(&["review"]).unwrap().unwrap().file,
Some("review".into())
);
assert_eq!(
parse(&["--", "--review"]).unwrap().unwrap().file,
Some("--review".into())
);
assert!(
parse(&["--no-config", "--review", "list", "--repo", ".", "--json"])
.unwrap()
.unwrap()
.review
.is_some()
);
assert!(
parse(&["--review", "show", "1", "--all", "--no-config"])
.unwrap()
.unwrap()
.review
.is_some()
);
for args in [
vec!["--review"],
vec!["--review", "show"],
vec!["--review", "show", "0"],
vec!["--review", "show", "-1"],
vec!["--review", "show", "abc"],
vec!["--review", "list", "--all"],
vec!["--review", "list", "--repo"],
vec!["--review", "list", "--repo", ".", "--repo", "."],
vec!["--review", "list", "extra"],
vec!["--review", "list", "--", "extra"],
vec!["--review", "list", "--config", "x", "--no-config"],
] {
assert!(parse(&args).is_err(), "{args:?}");
}
}