shithub: hugo

Download patch

ref: bf76e744321c7a51f546a09df0af2c009ff0d779
parent: 1cb7ed6ac7fd808b7755a47ffc4878506a42d13c
author: Bjørn Erik Pedersen <[email protected]>
date: Wed Mar 23 11:02:00 EDT 2016

parser: Fix ALL_CAPS var names in test

--- a/parser/parse_frontmatter_test.go
+++ b/parser/parse_frontmatter_test.go
@@ -26,20 +26,20 @@
 )
 
 var (
-	CONTENT_NO_FRONTMATTER          = "a page with no front matter"
-	CONTENT_WITH_FRONTMATTER        = "---\ntitle: front matter\n---\nContent with front matter"
-	CONTENT_HTML_NODOCTYPE          = "<html>\n\t<body>\n\t</body>\n</html>"
-	CONTENT_HTML_WITHDOCTYPE        = "<!doctype html><html><body></body></html>"
-	CONTENT_HTML_WITH_FRONTMATTER   = "---\ntitle: front matter\n---\n<!doctype><html><body></body></html>"
-	CONTENT_LWS_HTML                = "    <html><body></body></html>"
-	CONTENT_LWS_LF_HTML             = "\n<html><body></body></html>"
-	CONTENT_INCOMPLETE_END_FM_DELIM = "---\ntitle: incomplete end fm delim\n--\nincomplete frontmatter delim"
-	CONTENT_MISSING_END_FM_DELIM    = "---\ntitle: incomplete end fm delim\nincomplete frontmatter delim"
-	CONTENT_SLUG_WORKING            = "---\ntitle: slug doc 2\nslug: slug-doc-2\n\n---\nslug doc 2 content"
-	CONTENT_SLUG_WORKING_VARIATION  = "---\ntitle: slug doc 3\nslug: slug-doc 3\n---\nslug doc 3 content"
-	CONTENT_SLUG_BUG                = "---\ntitle: slug doc 2\nslug: slug-doc-2\n---\nslug doc 2 content"
-	CONTENT_WITH_JS_FM              = "{\n  \"categories\": \"d\",\n  \"tags\": [\n    \"a\", \n    \"b\", \n    \"c\"\n  ]\n}\nJSON Front Matter with tags and categories"
-	CONTENT_WITH_JS_LOOSE_FM        = "{\n  \"categories\": \"d\"\n  \"tags\": [\n    \"a\" \n    \"b\" \n    \"c\"\n  ]\n}\nJSON Front Matter with tags and categories"
+	contentNoFrontmatter                 = "a page with no front matter"
+	contentWithFrontmatter               = "---\ntitle: front matter\n---\nContent with front matter"
+	contentHTMLNoDoctype                 = "<html>\n\t<body>\n\t</body>\n</html>"
+	contentHTMLWithDoctype               = "<!doctype html><html><body></body></html>"
+	contentHTMLWithFrontmatter           = "---\ntitle: front matter\n---\n<!doctype><html><body></body></html>"
+	contentHTML                          = "    <html><body></body></html>"
+	contentLinefeedAndHTML               = "\n<html><body></body></html>"
+	contentIncompleteEndFrontmatterDelim = "---\ntitle: incomplete end fm delim\n--\nincomplete frontmatter delim"
+	contentMissingEndFrontmatterDelim    = "---\ntitle: incomplete end fm delim\nincomplete frontmatter delim"
+	contentSlugWorking                   = "---\ntitle: slug doc 2\nslug: slug-doc-2\n\n---\nslug doc 2 content"
+	contentSlugWorkingVariation          = "---\ntitle: slug doc 3\nslug: slug-doc 3\n---\nslug doc 3 content"
+	contentSlugBug                       = "---\ntitle: slug doc 2\nslug: slug-doc-2\n---\nslug doc 2 content"
+	contentSlugWithJSONFrontMatter       = "{\n  \"categories\": \"d\",\n  \"tags\": [\n    \"a\", \n    \"b\", \n    \"c\"\n  ]\n}\nJSON Front Matter with tags and categories"
+	contentWithJSONLooseFrontmatter      = "{\n  \"categories\": \"d\"\n  \"tags\": [\n    \"a\" \n    \"b\" \n    \"c\"\n  ]\n}\nJSON Front Matter with tags and categories"
 )
 
 var lineEndings = []string{"\n", "\r\n"}
@@ -56,8 +56,8 @@
 	tests := []struct {
 		content string
 	}{
-		{CONTENT_MISSING_END_FM_DELIM},
-		{CONTENT_INCOMPLETE_END_FM_DELIM},
+		{contentMissingEndFrontmatterDelim},
+		{contentIncompleteEndFrontmatterDelim},
 	}
 
 	for _, test := range tests {
@@ -108,18 +108,18 @@
 		bodycontent        string
 	}{
 
-		{CONTENT_NO_FRONTMATTER, true, true, "", "a page with no front matter"},
-		{CONTENT_WITH_FRONTMATTER, true, false, "---\ntitle: front matter\n---\n", "Content with front matter"},
-		{CONTENT_HTML_NODOCTYPE, false, true, "", "<html>\n\t<body>\n\t</body>\n</html>"},
-		{CONTENT_HTML_WITHDOCTYPE, false, true, "", "<!doctype html><html><body></body></html>"},
-		{CONTENT_HTML_WITH_FRONTMATTER, true, false, "---\ntitle: front matter\n---\n", "<!doctype><html><body></body></html>"},
-		{CONTENT_LWS_HTML, false, true, "", "<html><body></body></html>"},
-		{CONTENT_LWS_LF_HTML, false, true, "", "<html><body></body></html>"},
-		{CONTENT_WITH_JS_FM, true, false, "{\n  \"categories\": \"d\",\n  \"tags\": [\n    \"a\", \n    \"b\", \n    \"c\"\n  ]\n}", "JSON Front Matter with tags and categories"},
-		{CONTENT_WITH_JS_LOOSE_FM, true, false, "{\n  \"categories\": \"d\"\n  \"tags\": [\n    \"a\" \n    \"b\" \n    \"c\"\n  ]\n}", "JSON Front Matter with tags and categories"},
-		{CONTENT_SLUG_WORKING, true, false, "---\ntitle: slug doc 2\nslug: slug-doc-2\n\n---\n", "slug doc 2 content"},
-		{CONTENT_SLUG_WORKING_VARIATION, true, false, "---\ntitle: slug doc 3\nslug: slug-doc 3\n---\n", "slug doc 3 content"},
-		{CONTENT_SLUG_BUG, true, false, "---\ntitle: slug doc 2\nslug: slug-doc-2\n---\n", "slug doc 2 content"},
+		{contentNoFrontmatter, true, true, "", "a page with no front matter"},
+		{contentWithFrontmatter, true, false, "---\ntitle: front matter\n---\n", "Content with front matter"},
+		{contentHTMLNoDoctype, false, true, "", "<html>\n\t<body>\n\t</body>\n</html>"},
+		{contentHTMLWithDoctype, false, true, "", "<!doctype html><html><body></body></html>"},
+		{contentHTMLWithFrontmatter, true, false, "---\ntitle: front matter\n---\n", "<!doctype><html><body></body></html>"},
+		{contentHTML, false, true, "", "<html><body></body></html>"},
+		{contentLinefeedAndHTML, false, true, "", "<html><body></body></html>"},
+		{contentSlugWithJSONFrontMatter, true, false, "{\n  \"categories\": \"d\",\n  \"tags\": [\n    \"a\", \n    \"b\", \n    \"c\"\n  ]\n}", "JSON Front Matter with tags and categories"},
+		{contentWithJSONLooseFrontmatter, true, false, "{\n  \"categories\": \"d\"\n  \"tags\": [\n    \"a\" \n    \"b\" \n    \"c\"\n  ]\n}", "JSON Front Matter with tags and categories"},
+		{contentSlugWorking, true, false, "---\ntitle: slug doc 2\nslug: slug-doc-2\n\n---\n", "slug doc 2 content"},
+		{contentSlugWorkingVariation, true, false, "---\ntitle: slug doc 3\nslug: slug-doc 3\n---\n", "slug doc 3 content"},
+		{contentSlugBug, true, false, "---\ntitle: slug doc 2\nslug: slug-doc-2\n---\n", "slug doc 2 content"},
 	}
 
 	for _, test := range tests {