shithub: hugo

Download patch

ref: e2634752ce7dcc2f6cf1902b0409206e0ed8a571
parent: f81f9ceb40db8b3dbb586e52a3939dd8a136502f
author: Owen Waller <[email protected]>
date: Sat Oct 11 19:49:53 EDT 2014

First stab at correcting GuessSection tests

Updated the test to correctly test for "" when a non-absolute path
is used.

But the tests still fail for multi-part paths e.g. /contents/blog/

--- a/helpers/path_test.go
+++ b/helpers/path_test.go
@@ -421,15 +421,19 @@
 	data := []test{
 		{"/", ""},
 		{"", ""},
-		{"/content", "/"},
-		{"content/", "/"},
-		{"/content/", "/"},
-		{"/blog", "/blog"},
-		{"/blog/", "/blog/"},
-		{"blog", "blog"},
-		{"content/blog", "/blog"},
-		{"content/blog/", "/blog/"},
-		{"/content/blog", "/blog/"},
+		{"/content", ""},
+		{"content/", ""},
+		{"/content/", "content"},
+		{"/blog", ""},
+		{"/blog/", "blog"},
+		{"blog", ""},
+		{"content/blog", ""},
+		{"/content/blog/", "blog"},
+		{"/content/blog", "blog"},
+		{"content/blog/", ""},
+		{"/contents/myblog/", "contents"},
+		{"/contents/yourblog", "contents"},
+		{"/contents/ourblog/", "contents"},
 	}
 
 	for i, d := range data {