Skip to content

Commit db582d9

Browse files
authored
Improve wiki user title test (#24559)
The `..` should be covered by TestUserTitleToWebPath. Otherwise, if the random string is "..", it causes unnecessary failure in TestUserWebGitPathConsistency
1 parent bc888e5 commit db582d9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

services/wiki/wiki_test.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ func TestUserTitleToWebPath(t *testing.T) {
3434
UserTitle string
3535
}
3636
for _, test := range []test{
37+
{"unnamed", ""},
38+
{"unnamed", "."},
39+
{"unnamed", ".."},
3740
{"wiki-name", "wiki name"},
3841
{"title.md.-", "title.md"},
3942
{"wiki-name.-", "wiki-name"},
@@ -118,7 +121,7 @@ func TestUserWebGitPathConsistency(t *testing.T) {
118121
}
119122

120123
userTitle := strings.TrimSpace(string(b[:l]))
121-
if userTitle == "" || userTitle == "." {
124+
if userTitle == "" || userTitle == "." || userTitle == ".." {
122125
continue
123126
}
124127
webPath := UserTitleToWebPath("", userTitle)

0 commit comments

Comments
 (0)