(t *testing.T)
| 42 | } |
| 43 | |
| 44 | func TestIsProbablyHTML(t *testing.T) { |
| 45 | cases := []struct { |
| 46 | in []byte |
| 47 | expected bool |
| 48 | }{ |
| 49 | {[]byte("var foo = bar"), false}, |
| 50 | {[]byte(" \t\nvar foo = bar"), false}, |
| 51 | {[]byte("lol this isn't even JavaScript"), false}, |
| 52 | {[]byte("<!doctype html><html>"), true}, |
| 53 | {[]byte(" \t\n<div><p>"), true}, |
| 54 | } |
| 55 | |
| 56 | for _, c := range cases { |
| 57 | actual := isProbablyHTML(c.in) |
| 58 | |
| 59 | if actual != c.expected { |
| 60 | t.Errorf("want %t for isProbablyHTML(%q); have %t", c.expected, c.in, actual) |
| 61 | } |
| 62 | } |
| 63 | } |
nothing calls this directly
no test coverage detected