diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2017-06-03 12:31:31 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2017-06-03 12:35:28 +0200 |
commit | 2c2ce33a39d5fd70e812ac088fa04401ea623d3b (patch) | |
tree | 33d3eec5db0e57d0a7c324cf16ff373edb5eaaf2 | |
parent | adc0572d2941cc7193f360c50c9367786cf29f26 (diff) |
parser: Add horizontal YAML tags to benchmark
-rw-r--r-- | parser/frontmatter_test.go | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/parser/frontmatter_test.go b/parser/frontmatter_test.go index 85c7c1874..2e5bdec50 100644 --- a/parser/frontmatter_test.go +++ b/parser/frontmatter_test.go @@ -322,8 +322,8 @@ func TestRemoveTOMLIdentifier(t *testing.T) { func BenchmarkFrontmatterTags(b *testing.B) { - for _, frontmatter := range []string{"JSON", "YAML", "TOML"} { - for i := 1; i < 30; i += 10 { + for _, frontmatter := range []string{"JSON", "YAML", "YAML2", "TOML"} { + for i := 1; i < 60; i += 20 { doBenchmarkFrontmatter(b, frontmatter, i) } } @@ -336,6 +336,12 @@ tags: %s --- ` + + yaml2Template := `--- +name: "Tags" +tags: %s +--- +` tomlTemplate := `+++ name = "Tags" tags = %s @@ -364,6 +370,9 @@ tags = %s } else if fileformat == "JSON" { frontmatterTemplate = jsonTemplate tagsStr = strings.Replace(fmt.Sprintf("%q", tags), " ", ", ", -1) + } else if fileformat == "YAML2" { + frontmatterTemplate = yaml2Template + tagsStr = strings.Replace(fmt.Sprintf("%q", tags), " ", ", ", -1) } else { frontmatterTemplate = yamlTemplate for _, tag := range tags { |