v0.0.4: add sessions and refine tui
This commit is contained in:
@@ -37,6 +37,26 @@ func TestRenderMarkdownSupportsThemesAndNarrowWidth(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestRenderMarkdownDoesNotEmitBackgroundColors(t *testing.T) {
|
||||
content := "# Title\n\n`inline`\n\n```go\nfmt.Println(\"x\")\n```"
|
||||
for _, mode := range []ThemeMode{ThemeLight, ThemeDark} {
|
||||
rendered := renderMarkdown(content, 80, themeForMode(mode))
|
||||
if backgroundPattern.MatchString(rendered) {
|
||||
t.Fatalf("markdown output for %s should not emit background colors:\n%q", mode, rendered)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestRenderMarkdownTrimsGlamourTrailingSpaces(t *testing.T) {
|
||||
rendered := renderMarkdown("hello", 80, themeForMode(ThemeLight))
|
||||
plain := stripANSI(rendered)
|
||||
if plain != "hello" {
|
||||
t.Fatalf("markdown should not pad a plain assistant line:\n%q", plain)
|
||||
}
|
||||
}
|
||||
|
||||
var backgroundPattern = regexp.MustCompile(`\x1b\[[0-9;:]*48[;:][0-9;:]*m`)
|
||||
|
||||
var ansiPattern = regexp.MustCompile(`\x1b\[[0-9;:]*[A-Za-z]`)
|
||||
|
||||
func stripANSI(value string) string {
|
||||
|
||||
Reference in New Issue
Block a user