mirror of
https://github.com/miniflux/v2.git
synced 2025-07-02 16:38:37 +00:00
First commit
This commit is contained in:
commit
8ffb773f43
2121 changed files with 1118910 additions and 0 deletions
51
vendor/github.com/PuerkitoBio/goquery/bench_property_test.go
generated
vendored
Normal file
51
vendor/github.com/PuerkitoBio/goquery/bench_property_test.go
generated
vendored
Normal file
|
@ -0,0 +1,51 @@
|
|||
package goquery
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func BenchmarkAttr(b *testing.B) {
|
||||
var s string
|
||||
|
||||
b.StopTimer()
|
||||
sel := DocW().Find("h1")
|
||||
b.StartTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
s, _ = sel.Attr("id")
|
||||
}
|
||||
if s != "firstHeading" {
|
||||
b.Fatalf("want firstHeading, got %q", s)
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkText(b *testing.B) {
|
||||
b.StopTimer()
|
||||
sel := DocW().Find("h2")
|
||||
b.StartTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
sel.Text()
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkLength(b *testing.B) {
|
||||
var n int
|
||||
|
||||
b.StopTimer()
|
||||
sel := DocW().Find("h2")
|
||||
b.StartTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
n = sel.Length()
|
||||
}
|
||||
if n != 14 {
|
||||
b.Fatalf("want 14, got %d", n)
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkHtml(b *testing.B) {
|
||||
b.StopTimer()
|
||||
sel := DocW().Find("h2")
|
||||
b.StartTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
sel.Html()
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue