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

Function TestDetectKitty

internal/spawner/spawner_test.go:134–160  ·  view source on GitHub ↗

TestDetectKitty verifies $KITTY_WINDOW_ID and $TERM=xterm-kitty both route to BackendKitty, and that kitty beats TERM_PROGRAM (kitty does not set TERM_PROGRAM, so without this check kitty users fall back to the iTerm path).

(t *testing.T)

Source from the content-addressed store, hash-verified

132// not set TERM_PROGRAM, so without this check kitty users fall back to
133// the iTerm path).
134func TestDetectKitty(t *testing.T) {
135 cases := []struct {
136 name string
137 kittyWindowID string
138 term string
139 termProgram string
140 }{
141 {"KITTY_WINDOW_ID set", "42", "", ""},
142 {"TERM=xterm-kitty", "", "xterm-kitty", ""},
143 {"both set", "42", "xterm-kitty", ""},
144 {"KITTY_WINDOW_ID set even with TERM_PROGRAM=iTerm.app", "42", "", "iTerm.app"},
145 {"TERM=xterm-kitty even with TERM_PROGRAM=iTerm.app", "", "xterm-kitty", "iTerm.app"},
146 }
147 for _, tc := range cases {
148 t.Run(tc.name, func(t *testing.T) {
149 t.Setenv("ZELLIJ", "")
150 t.Setenv("KITTY_WINDOW_ID", tc.kittyWindowID)
151 t.Setenv("TERM", tc.term)
152 t.Setenv("FLOW_TERM", "")
153 t.Setenv("TERM_PROGRAM", tc.termProgram)
154 Override = ""
155 if got := Detect(); got != BackendKitty {
156 t.Errorf("got %q, want %q", got, BackendKitty)
157 }
158 })
159 }
160}
161
162// TestDetectFlowTermOverride — FLOW_TERM with a valid backend value
163// wins over TERM_PROGRAM but loses to ZELLIJ and kitty. Iterates over

Callers

nothing calls this directly

Calls 1

DetectFunction · 0.85

Tested by

no test coverage detected