MCPcopy
hub / github.com/PuerkitoBio/goquery / loadDoc

Function loadDoc

type_test.go:109–123  ·  view source on GitHub ↗
(page string)

Source from the content-addressed store, hash-verified

107}
108
109func loadDoc(page string) *Document {
110 var f *os.File
111 var e error
112
113 if f, e = os.Open(fmt.Sprintf("./testdata/%s", page)); e != nil {
114 panic(e.Error())
115 }
116 defer f.Close()
117
118 var node *html.Node
119 if node, e = html.Parse(f); e != nil {
120 panic(e.Error())
121 }
122 return NewDocumentFromNode(node)
123}
124
125func loadString(t *testing.T, doc string) *Document {
126 d, err := NewDocumentFromReader(strings.NewReader(doc))

Callers 6

DocFunction · 0.85
Doc2Function · 0.85
Doc3Function · 0.85
DocBFunction · 0.85
DocWFunction · 0.85

Calls 1

NewDocumentFromNodeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…