MCPcopy
hub / github.com/docker/compose / TestLenAnsi

Function TestLenAnsi

cmd/display/tty_test.go:532–550  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

530}
531
532func TestLenAnsi(t *testing.T) {
533 testCases := []struct {
534 input string
535 expected int
536 }{
537 {"hello", 5},
538 {"\x1b[32mhello\x1b[0m", 5},
539 {"\x1b[1;32mgreen\x1b[0m text", 10},
540 {"", 0},
541 {"\x1b[0m", 0},
542 }
543
544 for _, tc := range testCases {
545 t.Run(tc.input, func(t *testing.T) {
546 result := lenAnsi(tc.input)
547 assert.Equal(t, tc.expected, result)
548 })
549 }
550}
551
552func TestDoneDeadlockFix(t *testing.T) {
553 w, _ := newTestWriter()

Callers

nothing calls this directly

Calls 1

lenAnsiFunction · 0.70

Tested by

no test coverage detected