MCPcopy Create free account
hub / github.com/diillson/chatcli / TestSignalUnixForceRefreshCleansTerminal

Function TestSignalUnixForceRefreshCleansTerminal

cli/terminal_ansi_test.go:137–164  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

135}
136
137func TestSignalUnixForceRefreshCleansTerminal(t *testing.T) {
138 logger, _ := zap.NewDevelopment()
139 defer func(logger *zap.Logger) {
140 err := logger.Sync()
141 if err != nil {
142 return
143 }
144 }(logger)
145
146 oldStdout := os.Stdout
147 r, w, _ := os.Pipe()
148 os.Stdout = w
149
150 cli := &ChatCLI{logger: logger}
151 cli.forceRefreshPrompt()
152
153 w.Close()
154 os.Stdout = oldStdout
155 out, _ := io.ReadAll(r)
156 output := string(out)
157
158 if !strings.Contains(output, "\033[K") {
159 t.Error("Expected output to contain clear line sequence")
160 }
161 if !strings.Contains(output, "\033[0m") {
162 t.Error("Expected output to contain ANSI reset")
163 }
164}

Callers

nothing calls this directly

Calls 4

forceRefreshPromptMethod · 0.95
SyncMethod · 0.80
CloseMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected