git@cosmocr.at/gitweb.git @ HEAD · summary refs log
HEAD / internal / render / highlight_test.go /
internal/render/highlight_test.go · 699 B · raw
view: SourceMarkdown ☑ force

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") } }