Adding benchmark for transformation module.

This commit is contained in:
Noah Campbell
2013-10-29 20:24:29 -07:00
parent 789aa6ad76
commit f4cb8e1688
4 changed files with 33 additions and 6 deletions

View File

@@ -16,7 +16,7 @@ func TestChainZeroTransformers(t *testing.T) {
func TestChainOneTransformer(t *testing.T) {
tr := NewChain(&AbsURL{BaseURL: "http://base"})
apply(t, tr, abs_url_tests)
apply(t.Errorf, tr, abs_url_tests)
}
const H5_JS_CONTENT_ABS_URL_WITH_NAV = "<!DOCTYPE html><html><head><script src=\"/foobar.js\"></script></head><body><nav><ul><li hugo-nav=\"section_0\"></li><li hugo-nav=\"section_1\"></li></ul></nav><article>content <a href=\"/foobar\">foobar</a>. Follow up</article></body></html>"
@@ -32,5 +32,16 @@ func TestChainTwoTransformer(t *testing.T) {
&AbsURL{BaseURL: "http://two"},
&NavActive{Section: "section_1"},
)
apply(t, tr, two_chain_tests)
apply(t.Errorf, tr, two_chain_tests)
}
func BenchmarkChain(b *testing.B) {
tr := NewChain(
&AbsURL{BaseURL: "http://two"},
&NavActive{Section: "section_1"},
)
for i := 0; i < b.N; i++ {
apply(b.Errorf, tr, two_chain_tests)
}
}