@@ -17,6 +17,7 @@ import (
17
17
"strings"
18
18
"testing"
19
19
20
+ qt "github.com/frankban/quicktest"
20
21
"github.com/gohugoio/hugo/hugofs"
21
22
"github.com/gohugoio/hugo/langs"
22
23
)
@@ -59,6 +60,7 @@ func TestAbsURL(t *testing.T) {
59
60
}
60
61
61
62
func doTestAbsURL (t * testing.T , defaultInSubDir , addLanguage , multilingual bool , lang string ) {
63
+ c := qt .New (t )
62
64
v := newTestCfg ()
63
65
v .Set ("multilingual" , multilingual )
64
66
v .Set ("defaultContentLanguage" , "en" )
@@ -69,6 +71,10 @@ func doTestAbsURL(t *testing.T, defaultInSubDir, addLanguage, multilingual bool,
69
71
baseURL string
70
72
expected string
71
73
}{
74
+ // Issue 9994
75
+ {"foo/bar" , "https://example.org/foo/" , "https://example.org/foo/MULTIfoo/bar" },
76
+ {"/foo/bar" , "https://example.org/foo/" , "https://example.org/MULTIfoo/bar" },
77
+
72
78
{"/test/foo" , "http://base/" , "http://base/MULTItest/foo" },
73
79
{"/" + lang + "/test/foo" , "http://base/" , "http://base/" + lang + "/test/foo" },
74
80
{"" , "http://base/ace/" , "http://base/ace/MULTI" },
@@ -113,9 +119,8 @@ func doTestAbsURL(t *testing.T, defaultInSubDir, addLanguage, multilingual bool,
113
119
} else {
114
120
expected = strings .Replace (expected , "MULTI" , "" , 1 )
115
121
}
116
- if output != expected {
117
- t .Fatalf ("Expected %#v, got %#v\n " , expected , output )
118
- }
122
+
123
+ c .Assert (output , qt .Equals , expected )
119
124
}
120
125
}
121
126
@@ -132,6 +137,7 @@ func TestRelURL(t *testing.T) {
132
137
}
133
138
134
139
func doTestRelURL (t * testing.T , defaultInSubDir , addLanguage , multilingual bool , lang string ) {
140
+ c := qt .New (t )
135
141
v := newTestCfg ()
136
142
v .Set ("multilingual" , multilingual )
137
143
v .Set ("defaultContentLanguage" , "en" )
@@ -143,13 +149,18 @@ func doTestRelURL(t *testing.T, defaultInSubDir, addLanguage, multilingual bool,
143
149
canonify bool
144
150
expected string
145
151
}{
152
+
153
+ // Issue 9994
154
+ {"/foo/bar" , "https://example.org/foo/" , false , "MULTI/foo/bar" },
155
+ {"foo/bar" , "https://example.org/foo/" , false , "/fooMULTI/foo/bar" },
156
+
146
157
{"/test/foo" , "http://base/" , false , "MULTI/test/foo" },
147
158
{"/" + lang + "/test/foo" , "http://base/" , false , "/" + lang + "/test/foo" },
148
159
{lang + "/test/foo" , "http://base/" , false , "/" + lang + "/test/foo" },
149
160
{"test.css" , "http://base/sub" , false , "/subMULTI/test.css" },
150
161
{"test.css" , "http://base/sub" , true , "MULTI/test.css" },
151
162
{"/test/" , "http://base/" , false , "MULTI/test/" },
152
- {"/ test/" , "http://base/sub/" , false , "/subMULTI/test/" },
163
+ {"test/" , "http://base/sub/" , false , "/subMULTI/test/" },
153
164
{"/test/" , "http://base/sub/" , true , "MULTI/test/" },
154
165
{"" , "http://base/ace/" , false , "/aceMULTI/" },
155
166
{"" , "http://base/ace" , false , "/aceMULTI" },
@@ -189,9 +200,8 @@ func doTestRelURL(t *testing.T, defaultInSubDir, addLanguage, multilingual bool,
189
200
expected = strings .Replace (expected , "MULTI" , "" , 1 )
190
201
}
191
202
192
- if output != expected {
193
- t .Errorf ("[%d][%t] Expected %#v, got %#v\n " , i , test .canonify , expected , output )
194
- }
203
+ c .Assert (output , qt .Equals , expected , qt .Commentf ("[%d] %s" , i , test .input ))
204
+
195
205
}
196
206
}
197
207
0 commit comments