You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
test: reproduce Starship prompt going static in bash sessions
The bash bootstrap Programa injects as PROMPT_COMMAND begins with
unset PROMPT_COMMAND. When a user's startup files run
eval "$(starship init bash)" before the first prompt, that appends
starship_precmd to PROMPT_COMMAND; the bootstrap's unset then throws it
away after running once, so the Starship prompt stops updating after
the first command.
Extract the bootstrap into its own file
(Resources/shell-integration/programa-bash-bootstrap.bash) so the app
and the test share one source of truth, and add a regression test that
drives the real bootstrap plus a Starship-shaped prompt hook through
bash. This keeps the current buggy behavior so CI shows the new test
red; the fix follows in the next commit.
"test setup did not append starship_precmd to PROMPT_COMMAND"+ debug
3365
+
)
3366
+
3367
+
foriin1...3{
3368
+
letpc=fields["PC_\(i)"]??""
3369
+
XCTAssertTrue(
3370
+
pc.contains("starship_precmd"),
3371
+
"starship_precmd was dropped from PROMPT_COMMAND at prompt \(i); the bootstrap took exclusive ownership instead of composing with the user's hook. PROMPT_COMMAND=<\(pc)>"+ debug
3372
+
)
3373
+
XCTAssertTrue(
3374
+
pc.contains("_cmux_prompt_command"),
3375
+
"Programa's own prompt hook is missing from PROMPT_COMMAND at prompt \(i): <\(pc)>"+ debug
3376
+
)
3377
+
}
3378
+
3379
+
letps1Values=(1...3).map{fields["PS1_\($0)"]??""}
3380
+
XCTAssertNotEqual(
3381
+
ps1Values[0],ps1Values[1],
3382
+
"starship prompt went static across prompts (it stopped re-rendering): \(ps1Values)"+ debug
3383
+
)
3384
+
XCTAssertNotEqual(
3385
+
ps1Values[1],ps1Values[2],
3386
+
"starship prompt went static across prompts (it stopped re-rendering): \(ps1Values)"+ debug
3387
+
)
3388
+
XCTAssertTrue(
3389
+
ps1Values[2].contains("n=3"),
3390
+
"starship_precmd did not run on every prompt; final PS1=<\(ps1Values[2])>"+ debug
3391
+
)
3392
+
XCTAssertTrue(
3393
+
ps1Values[2].contains("cwd=cd-target"),
3394
+
"prompt did not pick up the new cwd after cd; final PS1=<\(ps1Values[2])>"+ debug
0 commit comments