First stab at correcting GuessSection tests
authorOwen Waller <o.waller@kulawe.com>
Sat, 11 Oct 2014 22:49:53 +0000 (23:49 +0100)
committerspf13 <steve.francia@gmail.com>
Wed, 5 Nov 2014 00:19:27 +0000 (19:19 -0500)
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/

helpers/path_test.go

index e6dc1e7616af254e022d0ad591576ca00f6b60e1..6079185811a4900646cc3355f377346c65f51dcf 100644 (file)
@@ -421,15 +421,19 @@ func TestGuessSection(t *testing.T) {
        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 {