diff options
| author | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-06-30 17:47:12 +0300 |
|---|---|---|
| committer | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-06-30 17:49:37 +0300 |
| commit | 13cb5d9ae6aa314744ce5362b5d156182f06b503 (patch) | |
| tree | 8153bf4ffd1035bdc8b3dff7753fe87f86ba44dd /tests/cli_wrapper.rs | |
| parent | b7015f17a49501e99642009ebadabcbefc0fbad0 (diff) | |
feat: add shell completions
refs #435
Diffstat (limited to 'tests/cli_wrapper.rs')
| -rw-r--r-- | tests/cli_wrapper.rs | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/cli_wrapper.rs b/tests/cli_wrapper.rs index ea402515..99d4f107 100644 --- a/tests/cli_wrapper.rs +++ b/tests/cli_wrapper.rs @@ -1031,6 +1031,7 @@ fn help_commands_exit_successfully() { &["--help"], &["api", "-h"], &["api", "schema", "-h"], + &["completion", "-h"], &["status", "-h"], &["server", "-h"], &["workspace", "-h"], @@ -1060,6 +1061,46 @@ fn help_commands_exit_successfully() { } #[test] +fn completion_command_prints_zsh_script_without_session_startup() { + let output = Command::new(env!("CARGO_BIN_EXE_herdr")) + .args(["completion", "zsh"]) + .env_remove("HERDR_SOCKET_PATH") + .env_remove("HERDR_CLIENT_SOCKET_PATH") + .env_remove("HERDR_ENV") + .output() + .unwrap(); + + assert!( + output.status.success(), + "status={:?} stderr={}", + output.status.code(), + String::from_utf8_lossy(&output.stderr) + ); + let stdout = String::from_utf8_lossy(&output.stdout); + assert!(stdout.contains("#compdef herdr"), "stdout: {stdout}"); + assert!( + stdout.contains("bash elvish fish powershell zsh"), + "stdout: {stdout}" + ); + assert!( + stdout.contains("'--direction[]:DIRECTION:(right down)'"), + "pane split/plugin pane open should complete --direction right|down without requiring equals: {stdout}" + ); + assert!( + !stdout.contains("--cwd=[]"), + "zsh completions should not suggest equals-style values unsupported by most manual parsers: {stdout}" + ); + assert!( + !stdout.contains("--direction=[]"), + "zsh completions should not suggest equals-style direction values: {stdout}" + ); + assert!( + !stdout.contains("live-handoff"), + "internal server handoff command should not be completed: {stdout}" + ); +} + +#[test] fn root_help_hides_explicit_client_command() { let output = Command::new(env!("CARGO_BIN_EXE_herdr")) .arg("--help") |
