| 1 | package highlight |
| 2 | |
| 3 | import ( |
| 4 | "strings" |
| 5 | "testing" |
| 6 | ) |
| 7 | |
| 8 | func TestGoKeywordAndEscape(t *testing.T) { |
| 9 | got := Lines("main.go", "func main() {\n\t// <script>\n\treturn\n}\n") |
| 10 | if len(got) != 4 { |
| 11 | t.Fatalf("regels %d", len(got)) |
| 12 | } |
| 13 | if !strings.Contains(got[0], `class="hl-k">func</span>`) { |
| 14 | t.Fatalf("keyword: %s", got[0]) |
| 15 | } |
| 16 | if !strings.Contains(got[1], "<script>") || !strings.Contains(got[1], "hl-c") { |
| 17 | t.Fatalf("comment: %s", got[1]) |
| 18 | } |
| 19 | } |