summaryrefslogtreecommitdiffstats
path: root/helpers/path_test.go
diff options
context:
space:
mode:
authorspf13 <steve.francia@gmail.com>2014-11-04 20:19:45 -0500
committerspf13 <steve.francia@gmail.com>2014-11-04 20:19:45 -0500
commita40bd3caf16ecabc189dd6e676792555d175540b (patch)
treecdff36023ee3a5035124fb8673a5d6e8271b2222 /helpers/path_test.go
parente2634752ce7dcc2f6cf1902b0409206e0ed8a571 (diff)
rewriting guessSection to accurately reflect intent and usage. Update tests.
Diffstat (limited to 'helpers/path_test.go')
-rw-r--r--helpers/path_test.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/helpers/path_test.go b/helpers/path_test.go
index 607918581..bab1786e2 100644
--- a/helpers/path_test.go
+++ b/helpers/path_test.go
@@ -423,17 +423,20 @@ func TestGuessSection(t *testing.T) {
{"", ""},
{"/content", ""},
{"content/", ""},
- {"/content/", "content"},
+ {"/content/", ""}, // /content/ is a special case. It will never be the section
{"/blog", ""},
{"/blog/", "blog"},
{"blog", ""},
{"content/blog", ""},
{"/content/blog/", "blog"},
- {"/content/blog", "blog"},
- {"content/blog/", ""},
+ {"/content/blog", ""}, // Lack of trailing slash indicates 'blog' is not a directory.
+ {"content/blog/", "blog"},
{"/contents/myblog/", "contents"},
{"/contents/yourblog", "contents"},
{"/contents/ourblog/", "contents"},
+ {"/content/myblog/", "myblog"},
+ {"/content/yourblog", ""},
+ {"/content/ourblog/", "ourblog"},
}
for i, d := range data {