(t *testing.T)
| 530 | } |
| 531 | |
| 532 | func 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 | |
| 552 | func TestDoneDeadlockFix(t *testing.T) { |
| 553 | w, _ := newTestWriter() |