package render import ( "strings" "testing" ) func TestHighlightClassBasedNoInlineStyle(t *testing.T) { html, err := Highlight("main.go", []byte("package main\n\nfunc main() {}\n")) if err != nil { t.Fatalf("Highlight: %v", err) } s := string(html) if !strings.Contains(s, "class=") { t.Fatal("expected class-based output") } if strings.Contains(s, "style=") { t.Fatalf("unexpected inline style in output: %s", s) } } func TestIsBinary(t *testing.T) { if IsBinary([]byte("hello world\n")) { t.Fatal("text reported as binary") } if !IsBinary([]byte("PNG\x00\x01\x02binary")) { t.Fatal("binary not detected") } if IsBinary(nil) { t.Fatal("empty reported as binary") } }