mirror of
https://gitea.tendokyu.moe/beerpsi/fsdecrypt.git
synced 2026-09-28 01:37:59 +03:00
test: add a CLI --help integration test
Runs the built binary with --help and asserts it exits 0 and prints the usage, options, and about text (visible via cargo test -- --nocapture). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
d92e4b5ba9
commit
0a7b633310
@@ -0,0 +1,24 @@
|
||||
//! End-to-end CLI tests that run the actual built binary.
|
||||
|
||||
use std::process::Command;
|
||||
|
||||
/// `--help` must exit successfully and print the usage/options. Run with
|
||||
/// `cargo test -- --nocapture` to see the help text in the test output.
|
||||
#[test]
|
||||
fn help_shows_usage_and_options() {
|
||||
let output = Command::new(env!("CARGO_BIN_EXE_fsdecrypt"))
|
||||
.arg("--help")
|
||||
.output()
|
||||
.expect("failed to run fsdecrypt --help");
|
||||
|
||||
let stdout = String::from_utf8_lossy(&output.stdout);
|
||||
println!("\n--- fsdecrypt --help ---\n{stdout}");
|
||||
|
||||
assert!(output.status.success(), "--help should exit 0");
|
||||
assert!(stdout.contains("Usage"), "help should show a usage line");
|
||||
assert!(stdout.contains("--no-extract"), "help should list options");
|
||||
assert!(
|
||||
stdout.contains("decryptor for some SEGA containers"),
|
||||
"help should show the about text"
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user