-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcli_tests.rs
More file actions
35 lines (31 loc) · 1.16 KB
/
cli_tests.rs
File metadata and controls
35 lines (31 loc) · 1.16 KB
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
use std::path::PathBuf;
#[cfg(debug_assertions)]
#[test]
fn test_run_subcommand_exposed_in_debug_builds() {
let binary_path = PathBuf::from(env!("CARGO_BIN_EXE_ado-aw"));
let output = std::process::Command::new(&binary_path)
.arg("--help")
.output()
.expect("Failed to run ado-aw --help");
assert!(output.status.success(), "--help should succeed");
let stdout = String::from_utf8_lossy(&output.stdout);
assert!(
stdout.contains("Run agent locally"),
"Debug build help output should include the run subcommand, got:\n{stdout}"
);
}
#[cfg(not(debug_assertions))]
#[test]
fn test_run_subcommand_not_exposed_in_release_builds() {
let binary_path = PathBuf::from(env!("CARGO_BIN_EXE_ado-aw"));
let output = std::process::Command::new(&binary_path)
.arg("--help")
.output()
.expect("Failed to run ado-aw --help");
assert!(output.status.success(), "--help should succeed");
let stdout = String::from_utf8_lossy(&output.stdout);
assert!(
!stdout.contains("Run agent locally"),
"Release build help output should not include the run subcommand, got:\n{stdout}"
);
}