summaryrefslogtreecommitdiffstats
path: root/hugolib/page_permalink_test.go
diff options
context:
space:
mode:
authorAnton Ageev <antage@gmail.com>2014-02-02 04:58:14 +0400
committerspf13 <steve.francia@gmail.com>2014-02-02 00:56:01 -0500
commit72ba6d633d2a24d03bf16d927d7b87a20c28fda6 (patch)
tree4cf7a61cb8d276c651a604c6b0fda6a8e37f9a6e /hugolib/page_permalink_test.go
parent3e87d7a86e5dcd244dd713c8712a26f51f02be87 (diff)
Fix permalink bug in uglyurls mode (refs #187).
Diffstat (limited to 'hugolib/page_permalink_test.go')
-rw-r--r--hugolib/page_permalink_test.go25
1 files changed, 18 insertions, 7 deletions
diff --git a/hugolib/page_permalink_test.go b/hugolib/page_permalink_test.go
index fd1f2b2f8..614522fed 100644
--- a/hugolib/page_permalink_test.go
+++ b/hugolib/page_permalink_test.go
@@ -11,23 +11,34 @@ func TestPermalink(t *testing.T) {
dir string
base template.URL
slug string
+ uglyurls bool
expectedAbs string
expectedRel string
}{
- {"x/y/z/boofar.md", "x/y/z", "", "", "/x/y/z/boofar", "/x/y/z/boofar"},
- {"x/y/z/boofar.md", "x/y/z/", "", "", "/x/y/z/boofar", "/x/y/z/boofar"},
- {"x/y/z/boofar.md", "x/y/z/", "", "boofar", "/x/y/z/boofar/", "/x/y/z/boofar/"},
- {"x/y/z/boofar.md", "x/y/z", "http://barnew/", "", "http://barnew/x/y/z/boofar", "/x/y/z/boofar"},
- {"x/y/z/boofar.md", "x/y/z/", "http://barnew/", "boofar", "http://barnew/x/y/z/boofar/", "/x/y/z/boofar/"},
+ {"x/y/z/boofar.md", "x/y/z", "", "", false, "/x/y/z/boofar", "/x/y/z/boofar"},
+ {"x/y/z/boofar.md", "x/y/z/", "", "", false, "/x/y/z/boofar", "/x/y/z/boofar"},
+ {"x/y/z/boofar.md", "x/y/z/", "", "boofar", false, "/x/y/z/boofar/", "/x/y/z/boofar/"},
+ {"x/y/z/boofar.md", "x/y/z", "http://barnew/", "", false, "http://barnew/x/y/z/boofar", "/x/y/z/boofar"},
+ {"x/y/z/boofar.md", "x/y/z/", "http://barnew/", "boofar", false, "http://barnew/x/y/z/boofar/", "/x/y/z/boofar/"},
+ {"x/y/z/boofar.md", "x/y/z", "", "", true, "/x/y/z/boofar.html", "/x/y/z/boofar.html"},
+ {"x/y/z/boofar.md", "x/y/z/", "", "", true, "/x/y/z/boofar.html", "/x/y/z/boofar.html"},
+ {"x/y/z/boofar.md", "x/y/z/", "", "boofar", true, "/x/y/z/boofar.html", "/x/y/z/boofar.html"},
+ {"x/y/z/boofar.md", "x/y/z", "http://barnew/", "", true, "http://barnew/x/y/z/boofar.html", "/x/y/z/boofar.html"},
+ {"x/y/z/boofar.md", "x/y/z/", "http://barnew/", "boofar", true, "http://barnew/x/y/z/boofar.html", "/x/y/z/boofar.html"},
}
for _, test := range tests {
p := &Page{
Node: Node{
UrlPath: UrlPath{Section: "z"},
- Site: SiteInfo{BaseUrl: test.base},
+ Site: SiteInfo{
+ BaseUrl: test.base,
+ Config: &Config{
+ UglyUrls: test.uglyurls,
+ },
+ },
},
- File: File{FileName: test.file, Dir: test.dir},
+ File: File{FileName: test.file, Dir: test.dir, Extension: "html"},
}
if test.slug != "" {