summaryrefslogtreecommitdiffstats
path: root/hugolib/alias_test.go
diff options
context:
space:
mode:
authorHelder Pereira <helfper@gmail.com>2020-06-14 22:33:00 +0100
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2020-06-15 12:19:59 +0200
commitf720fe56db9e064d10b86d98e7bbd40fb1c8489f (patch)
treea35e72e96417a981846a629e713699e2f3ce0df2 /hugolib/alias_test.go
parentd6ed17c60fd13c933347110c720afa09e04df1c8 (diff)
Fix aliases with uglyURLs
Diffstat (limited to 'hugolib/alias_test.go')
-rw-r--r--hugolib/alias_test.go19
1 files changed, 11 insertions, 8 deletions
diff --git a/hugolib/alias_test.go b/hugolib/alias_test.go
index 17c663496..a1736e7e8 100644
--- a/hugolib/alias_test.go
+++ b/hugolib/alias_test.go
@@ -46,12 +46,15 @@ func TestAlias(t *testing.T) {
c := qt.New(t)
tests := []struct {
- urlPrefix string
- settings map[string]interface{}
+ fileSuffix string
+ urlPrefix string
+ urlSuffix string
+ settings map[string]interface{}
}{
- {"http://example.com", map[string]interface{}{"baseURL": "http://example.com"}},
- {"http://example.com", map[string]interface{}{"baseURL": "http://example.com", "canonifyURLs": true}},
- {"../..", map[string]interface{}{"relativeURLs": true}},
+ {"/index.html", "http://example.com", "/", map[string]interface{}{"baseURL": "http://example.com"}},
+ {"/index.html", "http://example.com", "/", map[string]interface{}{"baseURL": "http://example.com", "canonifyURLs": true}},
+ {"/index.html", "../..", "/", map[string]interface{}{"relativeURLs": true}},
+ {".html", "", ".html", map[string]interface{}{"uglyURLs": true}},
}
for _, test := range tests {
@@ -63,10 +66,10 @@ func TestAlias(t *testing.T) {
c.Assert(len(b.H.Sites[0].RegularPages()), qt.Equals, 1)
// the real page
- b.AssertFileContent("public/blog/page/index.html", "For some moments the old man")
+ b.AssertFileContent("public/blog/page"+test.fileSuffix, "For some moments the old man")
// the alias redirectors
- b.AssertFileContent("public/foo/bar/index.html", "<meta http-equiv=\"refresh\" content=\"0; url="+test.urlPrefix+"/blog/page/\" />")
- b.AssertFileContent("public/blog/rel/index.html", "<meta http-equiv=\"refresh\" content=\"0; url="+test.urlPrefix+"/blog/page/\" />")
+ b.AssertFileContent("public/foo/bar"+test.fileSuffix, "<meta http-equiv=\"refresh\" content=\"0; url="+test.urlPrefix+"/blog/page"+test.urlSuffix+"\" />")
+ b.AssertFileContent("public/blog/rel"+test.fileSuffix, "<meta http-equiv=\"refresh\" content=\"0; url="+test.urlPrefix+"/blog/page"+test.urlSuffix+"\" />")
}
}