parser: Add horizontal YAML tags to benchmark

This commit is contained in:
Bjørn Erik Pedersen 2017-06-03 12:31:31 +02:00
parent adc0572d29
commit 2c2ce33a39

View file

@ -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)
}
}
@ -335,6 +335,12 @@ name: "Tags"
tags:
%s
---
`
yaml2Template := `---
name: "Tags"
tags: %s
---
`
tomlTemplate := `+++
name = "Tags"
@ -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 {