package highlight
import (
"strings"
"testing"
)
func TestNumberedDrawsAGutter(t *testing.T) {
html, ok := Numbered([]byte("package main\n\nfunc main() {}\n"), "main.go")
if !ok {
t.Fatal("FAIL: a Go file was not highlighted")
}
if !strings.Contains(html, "lntable") || !strings.Contains(html, "lnt") {
t.Fatalf("FAIL: no line-number gutter in the output:\n%s", html)
}
t.Log("ok: a known language is highlighted with a line-number gutter")
}
// A file no lexer claims still gets numbers. The gutter is the reason
// the viewer exists; colour is the bonus.
func TestNumberedFallsBackForUnknownContent(t *testing.T) {
html, ok := Numbered([]byte("2026-01-01 boot\n2026-01-02 halt\n"), "server.unknownext")
if !ok || !strings.Contains(html, "lnt") {
t.Fatalf("FAIL: unknown content answered ok=%v:\n%s", ok, html)
}
t.Log("ok: unknown content still draws numbered lines")
}
func TestNumberedDeclinesOversizeContent(t *testing.T) {
if _, ok := Numbered(make([]byte, MaxBytes+1), "big.txt"); ok {
t.Fatal("FAIL: content past MaxBytes was highlighted")
}
t.Log("ok: the size valve holds for the numbered formatter too")
}