hugo

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

git clone git://git.shimmy1996.com/hugo.git
commit e467d23374f0e8db0bb7357725a156805bc1d662
parent 944090722e2af07ed5fc99ab78acae95c6792bc4
Author: Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Date:   Thu, 24 Mar 2016 13:30:08 +0100

hugoblib: Clean up the time tests

Diffstat:
Mhugolib/page_time_integration_test.go | 54++++++++++++++++++++++++++++--------------------------
1 file changed, 28 insertions(+), 26 deletions(-)
diff --git a/hugolib/page_time_integration_test.go b/hugolib/page_time_integration_test.go
@@ -21,73 +21,75 @@ import (
 	"time"
 )
 
-var PAGE_WITH_INVALID_DATE = `---
+const (
+	pageWithInvalidDate = `---
 date: 2010-05-02_15:29:31+08:00
 ---
 Page With Invalid Date (replace T with _ for RFC 3339)`
 
-var PAGE_WITH_DATE_RFC3339 = `---
+	pageWithDateRFC3339 = `---
 date: 2010-05-02T15:29:31+08:00
 ---
 Page With Date RFC3339`
 
-var PAGE_WITH_DATE_RFC3339_NO_T = `---
+	pageWithDateRFC3339NoT = `---
 date: 2010-05-02 15:29:31+08:00
 ---
 Page With Date RFC3339_NO_T`
 
-var PAGE_WITH_DATE_RFC1123 = `---
+	pageWithRFC1123 = `---
 date: Sun, 02 May 2010 15:29:31 PST
 ---
 Page With Date RFC1123`
 
-var PAGE_WITH_DATE_RFC1123Z = `---
+	pageWithDateRFC1123Z = `---
 date: Sun, 02 May 2010 15:29:31 +0800
 ---
 Page With Date RFC1123Z`
 
-var PAGE_WITH_DATE_RFC822 = `---
+	pageWithDateRFC822 = `---
 date: 02 May 10 15:29 PST
 ---
 Page With Date RFC822`
 
-var PAGE_WITH_DATE_RFC822Z = `---
+	pageWithDateRFC822Z = `---
 date: 02 May 10 15:29 +0800
 ---
 Page With Date RFC822Z`
 
-var PAGE_WITH_DATE_ANSIC = `---
+	pageWithDateANSIC = `---
 date: Sun May 2 15:29:31 2010
 ---
 Page With Date ANSIC`
 
-var PAGE_WITH_DATE_UnixDate = `---
+	pageWithDateUnixDate = `---
 date: Sun May 2 15:29:31 PST 2010
 ---
 Page With Date UnixDate`
 
-var PAGE_WITH_DATE_RubyDate = `---
+	pageWithDateRubyDate = `---
 date: Sun May 02 15:29:31 +0800 2010
 ---
 Page With Date RubyDate`
 
-var PAGE_WITH_DATE_HugoYearNumeric = `---
+	pageWithDateHugoYearNumeric = `---
 date: 2010-05-02
 ---
 Page With Date HugoYearNumeric`
 
-var PAGE_WITH_DATE_HugoYear = `---
+	pageWithDateHugoYear = `---
 date: 02 May 2010
 ---
 Page With Date HugoYear`
 
-var PAGE_WITH_DATE_HugoLong = `---
+	pageWithDateHugoLong = `---
 date: 02 May 2010 15:29 PST
 ---
 Page With Date HugoLong`
+)
 
 func TestDegenerateDateFrontMatter(t *testing.T) {
-	p, _ := NewPageFrom(strings.NewReader(PAGE_WITH_INVALID_DATE), "page/with/invalid/date")
+	p, _ := NewPageFrom(strings.NewReader(pageWithInvalidDate), "page/with/invalid/date")
 	if p.Date != *new(time.Time) {
 		t.Fatalf("Date should be set to time.Time zero value.  Got: %s", p.Date)
 	}
@@ -98,24 +100,24 @@ func TestParsingDateInFrontMatter(t *testing.T) {
 		buf string
 		dt  string
 	}{
-		{PAGE_WITH_DATE_RFC3339, "2010-05-02T15:29:31+08:00"},
-		{PAGE_WITH_DATE_RFC3339_NO_T, "2010-05-02T15:29:31+08:00"},
-		{PAGE_WITH_DATE_RFC1123Z, "2010-05-02T15:29:31+08:00"},
-		{PAGE_WITH_DATE_RFC822Z, "2010-05-02T15:29:00+08:00"},
-		{PAGE_WITH_DATE_ANSIC, "2010-05-02T15:29:31Z"},
-		{PAGE_WITH_DATE_RubyDate, "2010-05-02T15:29:31+08:00"},
-		{PAGE_WITH_DATE_HugoYearNumeric, "2010-05-02T00:00:00Z"},
-		{PAGE_WITH_DATE_HugoYear, "2010-05-02T00:00:00Z"},
+		{pageWithDateRFC3339, "2010-05-02T15:29:31+08:00"},
+		{pageWithDateRFC3339NoT, "2010-05-02T15:29:31+08:00"},
+		{pageWithDateRFC1123Z, "2010-05-02T15:29:31+08:00"},
+		{pageWithDateRFC822Z, "2010-05-02T15:29:00+08:00"},
+		{pageWithDateANSIC, "2010-05-02T15:29:31Z"},
+		{pageWithDateRubyDate, "2010-05-02T15:29:31+08:00"},
+		{pageWithDateHugoYearNumeric, "2010-05-02T00:00:00Z"},
+		{pageWithDateHugoYear, "2010-05-02T00:00:00Z"},
 	}
 
 	tzShortCodeTests := []struct {
 		buf string
 		dt  string
 	}{
-		{PAGE_WITH_DATE_RFC1123, "2010-05-02T15:29:31-08:00"},
-		{PAGE_WITH_DATE_RFC822, "2010-05-02T15:29:00-08:00Z"},
-		{PAGE_WITH_DATE_UnixDate, "2010-05-02T15:29:31-08:00"},
-		{PAGE_WITH_DATE_HugoLong, "2010-05-02T15:21:00+08:00"},
+		{pageWithRFC1123, "2010-05-02T15:29:31-08:00"},
+		{pageWithDateRFC822, "2010-05-02T15:29:00-08:00Z"},
+		{pageWithDateUnixDate, "2010-05-02T15:29:31-08:00"},
+		{pageWithDateHugoLong, "2010-05-02T15:21:00+08:00"},
 	}
 
 	if _, err := time.LoadLocation("PST"); err == nil {