diff options
author | bep <[email protected]> | 2015-05-03 20:57:47 +0200 |
---|---|---|
committer | bep <[email protected]> | 2015-05-03 20:57:39 +0200 |
commit | be96aacb116d7f585f368ee056a2e2282e68970b (patch) | |
tree | 6fcc2def0a68fc902be3be338e1bd24fb0ac726b /transform | |
parent | beb601c7ff5bb0c07e6b41bb0b7e21d73f0bb8a8 (diff) | |
download | hugo-be96aacb116d7f585f368ee056a2e2282e68970b.tar.gz hugo-be96aacb116d7f585f368ee056a2e2282e68970b.zip |
Add benchmark tests for srcset handling
See #1059
Diffstat (limited to 'transform')
-rw-r--r-- | transform/chain_test.go | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/transform/chain_test.go b/transform/chain_test.go index 10d47e9d4..cd6dfcde9 100644 --- a/transform/chain_test.go +++ b/transform/chain_test.go @@ -79,7 +79,6 @@ var extra_tests_html = []test{{REPLACE_SCHEMALESS_HTML, REPLACE_SCHEMALESS_HTML_ var abs_url_tests = append(abs_url_bench_tests, append(sanity_tests, extra_tests_html...)...) var extra_tests_xml = []test{{REPLACE_SCHEMALESS_XML, REPLACE_SCHEMALESS_XML_CORRECT}} var xml_abs_url_tests = append(xml_abs_url_bench_tests, append(sanity_tests, extra_tests_xml...)...) - var srcset_tests = []test{{SRCSET_BASIC, SRCSET_BASIC_CORRECT}, {SRCSET_SINGLE_QUOTE, SRCSET_SINGLE_QUOTE_CORRECT}, {SRCSET_VARIATIONS, SRCSET_VARIATIONS_CORRECT}} var srcset_xml_tests = []test{ {SRCSET_XML_BASIC, SRCSET_XML_BASIC_CORRECT}, @@ -134,6 +133,26 @@ func BenchmarkAbsURL(b *testing.B) { } } +func BenchmarkAbsURLSrcset(b *testing.B) { + absURL, _ := absURLFromURL("http://base") + tr := NewChain(absURL...) + + b.ResetTimer() + for i := 0; i < b.N; i++ { + apply(b.Errorf, tr, srcset_tests) + } +} + +func BenchmarkXMLAbsURLSrcset(b *testing.B) { + absXMLURL, _ := absURLInXMLFromURL("http://base") + tr := NewChain(absXMLURL...) + + b.ResetTimer() + for i := 0; i < b.N; i++ { + apply(b.Errorf, tr, srcset_xml_tests) + } +} + func TestAbsURL(t *testing.T) { absURL, _ := absURLFromURL("http://base") tr := NewChain(absURL...) |