Charm-based CLI with JSON persistence, status/list filters, external editor editing, command-history undo/redo, and glamour markdown without AutoStyle OSC hangs. Co-authored-by: Cursor <cursoragent@cursor.com>
33 lines
850 B
Go
33 lines
850 B
Go
package views_test
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
"time"
|
|
|
|
"task/internal/ui/views"
|
|
)
|
|
|
|
func TestRenderMarkdownFastWithoutAutoStyle(t *testing.T) {
|
|
src := "## Hello\n\nSome **bold** text\n\n- a\n- b\n"
|
|
start := time.Now()
|
|
out := views.RenderMarkdown(src, 80)
|
|
elapsed := time.Since(start)
|
|
if elapsed > 2*time.Second {
|
|
t.Fatalf("RenderMarkdown took %v — WithAutoStyle/OSC hang likely still present", elapsed)
|
|
}
|
|
if out == "" || out == src {
|
|
// glamour should style bold; at least produce non-empty output
|
|
if strings.TrimSpace(out) == "" {
|
|
t.Fatal("empty output")
|
|
}
|
|
}
|
|
// cached path should be near-instant
|
|
start = time.Now()
|
|
_ = views.RenderMarkdown(src, 80)
|
|
if time.Since(start) > 500*time.Millisecond {
|
|
t.Fatalf("cached render too slow: %v", time.Since(start))
|
|
}
|
|
t.Logf("first=%v cached=%v", elapsed, time.Since(start))
|
|
}
|