mirror of
https://github.com/storytold/deckcraft.git
synced 2026-10-24 10:37:03 -06:00
Merge PR #258 from RCShoemaker: fix(cli): render refuses an unknown option instead of writing it as a file (#235)
# Conflicts: # apps/deckcraft-cli/src/main.rs # contributors/people.toml
This commit is contained in:
@@ -570,6 +570,18 @@ mod tests {
|
||||
assert!(describe(Some("--help")).is_ok());
|
||||
assert!(mcp(&args(&["-h"])).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn render_refuses_an_unknown_option_instead_of_writing_it_as_a_file() {
|
||||
let out = std::env::temp_dir().join("deckcraft-cli-unknown-option.png");
|
||||
let _ = std::fs::remove_file(&out);
|
||||
for flag in ["--bogus", "-x"] {
|
||||
let args: Vec<String> = ["--sample", flag, &out.to_string_lossy()].iter().map(|a| a.to_string()).collect();
|
||||
let e = render(&args).unwrap_err();
|
||||
assert!(e.contains(&format!("unknown option `{flag}`")), "{flag}: {e}");
|
||||
assert!(!out.exists(), "{flag}: rendered anyway");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
@@ -48,3 +48,6 @@ sync_github_name = true
|
||||
|
||||
[people.Momentum96]
|
||||
sync_github_name = true
|
||||
|
||||
[people.RCShoemaker]
|
||||
real_name = "Ryan C. Shoemaker"
|
||||
|
||||
Reference in New Issue
Block a user