diff options
| author | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-05-19 13:35:40 +0300 |
|---|---|---|
| committer | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-05-19 13:35:40 +0300 |
| commit | 70c45dbeb3a7c62a7c87fe7c52e3e6d5a3acb0d5 (patch) | |
| tree | d1427a4818e61a24021da7a11cc0b3a061fa428c /tests/cli_wrapper.rs | |
| parent | fe53984c4092ef00cab51b1ddd77c5b890786670 (diff) | |
fix: hide explicit client command
refs #187
Diffstat (limited to 'tests/cli_wrapper.rs')
| -rw-r--r-- | tests/cli_wrapper.rs | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/cli_wrapper.rs b/tests/cli_wrapper.rs index affcb89a..aa06302e 100644 --- a/tests/cli_wrapper.rs +++ b/tests/cli_wrapper.rs @@ -591,6 +591,44 @@ fn help_commands_exit_successfully() { } #[test] +fn root_help_hides_explicit_client_command() { + let output = Command::new(env!("CARGO_BIN_EXE_herdr")) + .arg("--help") + .output() + .unwrap(); + + assert!(output.status.success()); + let stdout = String::from_utf8_lossy(&output.stdout); + assert!( + !stdout.contains("herdr client"), + "root help should not advertise the internal client command: {stdout}" + ); +} + +#[test] +fn explicit_client_command_respects_nested_guard() { + let base = unique_test_dir(); + fs::create_dir_all(&base).unwrap(); + + let output = Command::new(env!("CARGO_BIN_EXE_herdr")) + .arg("client") + .env("HERDR_ENV", "1") + .env("XDG_CONFIG_HOME", &base) + .env_remove("HERDR_CONFIG_PATH") + .output() + .unwrap(); + + cleanup_test_base(&base); + + assert_eq!(output.status.code(), Some(1)); + let stderr = String::from_utf8_lossy(&output.stderr); + assert!( + stderr.contains("nested herdr is disabled by default"), + "client should fail at the nested guard before connecting: {stderr}" + ); +} + +#[test] fn removed_show_changelog_flag_fails_before_nested_guard() { let output = Command::new(env!("CARGO_BIN_EXE_herdr")) .arg("--show-changelog") |
