MCPcopy
hub / github.com/BishopFox/jsluice / TestIsProbablyHTML

Function TestIsProbablyHTML

analyzer_test.go:44–63  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

42}
43
44func 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}

Callers

nothing calls this directly

Calls 1

isProbablyHTMLFunction · 0.85

Tested by

no test coverage detected