summaryrefslogtreecommitdiffstats
path: root/helpers/url_test.go
diff options
context:
space:
mode:
authorivan-meridianbanc-com <ivan@meridianbanc.com>2020-12-02 13:47:01 +0200
committerGitHub <noreply@github.com>2020-12-02 12:47:01 +0100
commitaebfe156fb2f27057e61b2e50c7576e6b06dab58 (patch)
treeb4f3cfaa0b55dbd1ef8dd7ca0f09e9993a1a2285 /helpers/url_test.go
parent907d9e92682ed56a57a2206ae9bd9a985b3e1870 (diff)
Fix RelURL and AbsURL when path starts with language
Diffstat (limited to 'helpers/url_test.go')
-rw-r--r--helpers/url_test.go31
1 files changed, 31 insertions, 0 deletions
diff --git a/helpers/url_test.go b/helpers/url_test.go
index 9223ba2cd..6f374f027 100644
--- a/helpers/url_test.go
+++ b/helpers/url_test.go
@@ -84,6 +84,21 @@ func doTestAbsURL(t *testing.T, defaultInSubDir, addLanguage, multilingual bool,
{"http//foo", "http://base/path", "http://base/path/MULTIhttp/foo"},
}
+ if multilingual && addLanguage && defaultInSubDir {
+ newTests := []struct {
+ input string
+ baseURL string
+ expected string
+ }{
+ {lang + "test", "http://base/", "http://base/" + lang + "/" + lang + "test"},
+ {"/" + lang + "test", "http://base/", "http://base/" + lang + "/" + lang + "test"},
+ }
+
+ for _, test := range newTests {
+ tests = append(tests, test)
+ }
+ }
+
for _, test := range tests {
v.Set("baseURL", test.baseURL)
v.Set("contentDir", "content")
@@ -164,6 +179,22 @@ func doTestRelURL(t *testing.T, defaultInSubDir, addLanguage, multilingual bool,
{"//schemaless", "http://base/", false, "//schemaless"},
}
+ if multilingual && addLanguage && defaultInSubDir {
+ newTests := []struct {
+ input string
+ baseURL string
+ canonify bool
+ expected string
+ }{
+ {lang + "test", "http://base/", false, "/" + lang + "/" + lang + "test"},
+ {"/" + lang + "test", "http://base/", false, "/" + lang + "/" + lang + "test"},
+ }
+
+ for _, test := range newTests {
+ tests = append(tests, test)
+ }
+ }
+
for i, test := range tests {
v.Set("baseURL", test.baseURL)
v.Set("canonifyURLs", test.canonify)