output: Improve layout path construction

This commit is contained in:
Cameron Moore
2020-10-15 13:54:47 -05:00
committed by GitHub
parent f033d9f01d
commit acfa153863
2 changed files with 61 additions and 46 deletions

View File

@@ -663,13 +663,25 @@ func TestLayout(t *testing.T) {
}
func BenchmarkLayout(b *testing.B) {
c := qt.New(b)
descriptor := LayoutDescriptor{Kind: "taxonomy", Section: "categories"}
l := NewLayoutHandler()
for i := 0; i < b.N; i++ {
layouts, err := l.For(descriptor, HTMLFormat)
c.Assert(err, qt.IsNil)
c.Assert(layouts, qt.Not(qt.HasLen), 0)
_, err := l.For(descriptor, HTMLFormat)
if err != nil {
panic(err)
}
}
}
func BenchmarkLayoutUncached(b *testing.B) {
for i := 0; i < b.N; i++ {
descriptor := LayoutDescriptor{Kind: "taxonomy", Section: "categories"}
l := NewLayoutHandler()
_, err := l.For(descriptor, HTMLFormat)
if err != nil {
panic(err)
}
}
}