MCPcopy Create free account
hub / github.com/Facets-cloud/flow / TestDetectFlowTermOverride

Function TestDetectFlowTermOverride

internal/spawner/spawner_test.go:166–192  ·  view source on GitHub ↗

TestDetectFlowTermOverride — FLOW_TERM with a valid backend value wins over TERM_PROGRAM but loses to ZELLIJ and kitty. Iterates over every valid backend value so we catch regressions where a new backend is added but missed in Detect()'s FLOW_TERM filter.

(t *testing.T)

Source from the content-addressed store, hash-verified

164// every valid backend value so we catch regressions where a new
165// backend is added but missed in Detect()'s FLOW_TERM filter.
166func TestDetectFlowTermOverride(t *testing.T) {
167 cases := []struct {
168 flowTerm string
169 want Backend
170 }{
171 {"iterm", BackendITerm},
172 {"terminal", BackendTerminal},
173 {"zellij", BackendZellij},
174 {"kitty", BackendKitty},
175 {"warp", BackendWarp},
176 {"ghostty", BackendGhostty},
177 }
178 for _, tc := range cases {
179 t.Run(tc.flowTerm, func(t *testing.T) {
180 t.Setenv("ZELLIJ", "")
181 t.Setenv("KITTY_WINDOW_ID", "")
182 t.Setenv("TERM", "")
183 t.Setenv("FLOW_TERM", tc.flowTerm)
184 t.Setenv("TERM_PROGRAM", "Apple_Terminal") // proves FLOW_TERM wins over TERM_PROGRAM
185 Override = ""
186 if got := Detect(); got != tc.want {
187 t.Errorf("Detect() with FLOW_TERM=%q: got %q, want %q",
188 tc.flowTerm, got, tc.want)
189 }
190 })
191 }
192}
193
194// TestDetectKittyBeatsFlowTerm — kitty's per-window markers beat
195// FLOW_TERM, matching ZELLIJ's behavior. Rationale: if the user is

Callers

nothing calls this directly

Calls 1

DetectFunction · 0.85

Tested by

no test coverage detected