hugo

Unnamed repository; edit this file 'description' to name the repository.

git clone git://git.shimmy1996.com/hugo.git
commit 2c2ce33a39d5fd70e812ac088fa04401ea623d3b
parent adc0572d2941cc7193f360c50c9367786cf29f26
Author: Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Date:   Sat,  3 Jun 2017 12:31:31 +0200

parser: Add horizontal YAML tags to benchmark

Diffstat:
Mparser/frontmatter_test.go | 13+++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git 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 {