File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change 88 "github.com/dyatlov/go-opengraph/opengraph"
99)
1010
11- func TestOpenGraphProcessHTML (t * testing.T ) {
12- html := `
11+ const html = `
1312 <!DOCTYPE html>
1413<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US">
1514<head profile="http://gmpg.org/xfn/11">
@@ -31,6 +30,19 @@ func TestOpenGraphProcessHTML(t *testing.T) {
3130<meta name="twitter:card" content="summary" />
3231<meta name="twitter:creator" content="@WordPress" />
3332 `
33+
34+ func BenchmarkOpenGraph_ProcessHTML (b * testing.B ) {
35+ og := opengraph .NewOpenGraph ()
36+ b .ReportAllocs ()
37+ b .SetBytes (int64 (len (html )))
38+ for i := 0 ; i < b .N ; i ++ {
39+ if err := og .ProcessHTML (strings .NewReader (html )); err != nil {
40+ b .Fatal (err )
41+ }
42+ }
43+ }
44+
45+ func TestOpenGraphProcessHTML (t * testing.T ) {
3446 og := opengraph .NewOpenGraph ()
3547 err := og .ProcessHTML (strings .NewReader (html ))
3648
You can’t perform that action at this time.
0 commit comments