hugolib: Clean up a benchmark

This commit is contained in:
Cameron Moore 2017-01-02 04:44:17 -06:00 committed by Bjørn Erik Pedersen
parent c344b1901f
commit cb63e87f8d
3 changed files with 13 additions and 31 deletions

View file

@ -14,8 +14,10 @@
package hugolib
import (
"bytes"
"fmt"
"html/template"
"os"
"path/filepath"
"reflect"
"sort"
@ -1396,3 +1398,14 @@ func TestShouldBuild(t *testing.T) {
}
}
}
func BenchmarkParsePage(b *testing.B) {
f, _ := os.Open("testdata/redis.cn.md")
var buf bytes.Buffer
buf.ReadFrom(f)
b.ResetTimer()
for i := 0; i < b.N; i++ {
page, _ := NewPage("bench")
page.ReadFrom(bytes.NewReader(buf.Bytes()))
}
}