Skip to content

Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows

test: correct detached-HEAD assertion and isolate raw Command usages (#3032)

Worktrunk Botac5877624c7e
diff --git a/tests/integration_tests/statusline.rs b/tests/integration_tests/statusline.rs
index c60e072ff..25aff709b 100644
--- a/tests/integration_tests/statusline.rs
+++ b/tests/integration_tests/statusline.rs
@@ -364,12 +364,16 @@ fn test_statusline_detached_head(mut repo: TestRepo) {
.run()
.unwrap();
- // Verify statusline shows HEAD (not "feature")
+ // Verify statusline shows the detached marker, not the prior branch name.
let output = run_statusline_from_dir(&repo, &[], None, &feature_path);
- // In detached state, we show "HEAD" as the branch name
+ // In detached state we render "(detached)" in place of a branch name.
assert!(
- output.contains("HEAD") || !output.contains("feature"),
- "statusline should not show 'feature' in detached HEAD, got: {output}"
+ output.contains("(detached)"),
+ "statusline should show '(detached)' for detached HEAD, got: {output}"
+ );
+ assert!(
+ !output.contains("feature"),
+ "statusline should not show the prior branch name, got: {output}"
);
}
@@ -861,7 +865,7 @@ fn test_statusline_rate_limit_5h_24h_locale(repo: TestRepo) {
#[rstest]
fn test_statusline_rate_limit_drops_at_narrow_width(repo: TestRepo) {
- // Same input as `5h_clock_time` but COLUMNS=80 — the rate-limit
+ // Same input as `5h_clock_time` but COLUMNS=40 — the rate-limit
// segment is the lowest-priority Claude-Code segment, so it drops first.
let json = build_claude_code_json(
repo.root_path(),
diff --git a/tests/integration_tests/user_hooks.rs b/tests/integration_tests/user_hooks.rs
index 090b5b724..ad8d3243a 100644
--- a/tests/integration_tests/user_hooks.rs
+++ b/tests/integration_tests/user_hooks.rs
@@ -2276,7 +2276,7 @@ test = "echo '{{ branch }}' > branch_output.txt"
#[rstest]
fn test_var_flag_invalid_format_fails() {
// Test that invalid KEY=VALUE format is rejected
- let output = std::process::Command::new(env!("CARGO_BIN_EXE_wt"))
+ let output = crate::common::wt_command()
.args(["hook", "pre-start", "--var", "no_equals_sign"])
.output()
.expect("Failed to run wt");
@@ -2624,7 +2624,7 @@ fn test_var_shorthand_does_not_leak_into_hook_show() {
// `wt hook show` doesn't accept `--var`, so shorthand preprocessing must
// leave its argv alone — an unknown flag should still produce clap's
// "unexpected argument" error, not a template-variable error.
- let output = std::process::Command::new(env!("CARGO_BIN_EXE_wt"))
+ let output = crate::common::wt_command()
.args(["hook", "show", "--branch=feature"])
.output()
.expect("Failed to run wt");