Commit ee57439e55

ee57439e5511ec0b91780bb464a95513f6821074

parent: 72eaa3a587

Verified · cmc

cmc <hello@cleberg.net> · 2026-10-02 03:19 UTC

e2e: tell terminal output by padding, not the header row

Ref #317

Layout: unified · split

e2e/term_test.go +5 −5
@@ -21,11 +21,11 @@ func TestTermEnvSelectsTerminalOutput(t *testing.T) {
21 } 21 }
22 22
23 plain, _, _ := inst.sshTerm(t, key, "", "repo", "list") 23 plain, _, _ := inst.sshTerm(t, key, "", "repo", "list")
24 if strings.Contains(plain, "PATH") || !strings.Contains(plain, "alice/app\t") { 24 if strings.Contains(plain, "alice/app ") || !strings.Contains(plain, "alice/app\t") {
25 t.Errorf("plain repo list: %q", plain) 25 t.Errorf("plain repo list: %q", plain)
26 } 26 }
27 term, _, _ := inst.sshTerm(t, key, "80,color", "repo", "list") 27 term, _, _ := inst.sshTerm(t, key, "80,color", "repo", "list")
28 if !strings.HasPrefix(term, "\x1b[2mPATH") { 28 if !strings.HasPrefix(term, "\x1b[2malice/app\x1b[0m ") {
29 t.Errorf("terminal repo list: %q", term) 29 t.Errorf("terminal repo list: %q", term)
30 } 30 }
31} 31}
@@ -75,13 +75,13 @@ func TestTermEnvOverMultiplexedSession(t *testing.T) {
75 exec.Command("ssh", "-o", "ControlPath="+sock, "-O", "exit", "git@127.0.0.1").Run() 75 exec.Command("ssh", "-o", "ControlPath="+sock, "-O", "exit", "git@127.0.0.1").Run()
76 }) 76 })
77 77
78 if out := mux("80"); !strings.HasPrefix(out, "PATH") { 78 if out := mux("80"); !strings.HasPrefix(out, "alice/app ") {
79 t.Fatalf("master session: %q", out) 79 t.Fatalf("master session: %q", out)
80 } 80 }
81 if out := mux("80,color"); !strings.HasPrefix(out, "\x1b[2mPATH") { 81 if out := mux("80,color"); !strings.HasPrefix(out, "\x1b[2malice/app") {
82 t.Errorf("second session kept the master's GITBAY_TERM: %q", out) 82 t.Errorf("second session kept the master's GITBAY_TERM: %q", out)
83 } 83 }
84 if out := mux(""); strings.Contains(out, "PATH") { 84 if out := mux(""); !strings.HasPrefix(out, "alice/app\t") {
85 t.Errorf("session without GITBAY_TERM got terminal output: %q", out) 85 t.Errorf("session without GITBAY_TERM got terminal output: %q", out)
86 } 86 }
87} 87}