stripANSIForTest removes CSI sequences so visible-content assertions run on plain text.
(s string)
| 72 | // stripANSIForTest removes CSI sequences so visible-content assertions run on |
| 73 | // plain text. |
| 74 | func stripANSIForTest(s string) string { |
| 75 | var b strings.Builder |
| 76 | esc := false |
| 77 | for _, c := range s { |
| 78 | if c == '\033' { |
| 79 | esc = true |
| 80 | continue |
| 81 | } |
| 82 | if esc { |
| 83 | if (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') { |
| 84 | esc = false |
| 85 | } |
| 86 | continue |
| 87 | } |
| 88 | b.WriteRune(c) |
| 89 | } |
| 90 | return b.String() |
| 91 | } |
| 92 | |
| 93 | // TestRenderMarkdown_ResolvesReferenceLinksAcrossCodeBlocks is the regression |
| 94 | // guard for the whole-document render: a reference link whose definition sits |
no test coverage detected