1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// Auto-generated tests for {{cli_name}} - Basic Category
// Generated by cli-testing-specialist v1.1.0
use assert_cmd::Command;
use predicates::prelude::*;
/// Test: Help option displays usage information
#[test]
fn test_help_option() {
let mut cmd = Command::cargo_bin("{{cli_name}}").unwrap();
cmd.arg("--help")
.assert()
.success()
.stdout(predicate::str::contains("Usage:"));
}
/// Test: Short help option (-h) works
#[test]
fn test_help_short_option() {
let mut cmd = Command::cargo_bin("{{cli_name}}").unwrap();
cmd.arg("-h")
.assert()
.success();
}
{{#if version}}
/// Test: Version option displays version
#[test]
fn test_version_option() {
let mut cmd = Command::cargo_bin("{{cli_name}}").unwrap();
cmd.arg("--version")
.assert()
.success()
.stdout(predicate::str::contains("{{version}}"));
}
{{/if}}
/// Test: Invalid option shows error and non-zero exit
#[test]
fn test_invalid_option() {
let mut cmd = Command::cargo_bin("{{cli_name}}").unwrap();
cmd.arg("--invalid-option-xyz")
.assert()
.failure();
}
{{#each subcommands}}
/// Test: {{name}} subcommand help
#[test]
fn test_subcommand_{{name}}_help() {
let mut cmd = Command::cargo_bin("{{../cli_name}}").unwrap();
cmd.arg("{{name}}")
.arg("--help")
.assert()
.success();
}
{{/each}}