forcePlainColor disables ANSI so width/content assertions are deterministic regardless of whether the test binary's stdout happens to be a TTY.
(t *testing.T)
| 13 | // forcePlainColor disables ANSI so width/content assertions are deterministic |
| 14 | // regardless of whether the test binary's stdout happens to be a TTY. |
| 15 | func forcePlainColor(t *testing.T) { |
| 16 | t.Helper() |
| 17 | prev := color.NoColor |
| 18 | color.NoColor = true |
| 19 | t.Cleanup(func() { color.NoColor = prev }) |
| 20 | } |
| 21 | |
| 22 | func TestDisplayWidth_StripsANSIAndCountsRunes(t *testing.T) { |
| 23 | // A literal SGR-wrapped string must measure the same as its plain form. |
no outgoing calls
no test coverage detected