diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2023-05-06 19:24:18 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-06 11:24:18 +0000 |
commit | db582d97ef6cd7d9f73a63c99639f6d00f40dc5a (patch) | |
tree | 7592900f169ea90e77f33b7fa208c1066f44fe7a /services | |
parent | bc888e5f9261d7d9eea2de88f7a803afffb8ded0 (diff) | |
download | gitea-db582d97ef6cd7d9f73a63c99639f6d00f40dc5a.tar.gz gitea-db582d97ef6cd7d9f73a63c99639f6d00f40dc5a.zip |
Improve wiki user title test (#24559)
The `..` should be covered by TestUserTitleToWebPath.
Otherwise, if the random string is "..", it causes unnecessary failure
in TestUserWebGitPathConsistency
Diffstat (limited to 'services')
-rw-r--r-- | services/wiki/wiki_test.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/services/wiki/wiki_test.go b/services/wiki/wiki_test.go index a781ebeda4..ccb230e06f 100644 --- a/services/wiki/wiki_test.go +++ b/services/wiki/wiki_test.go @@ -34,6 +34,9 @@ func TestUserTitleToWebPath(t *testing.T) { UserTitle string } for _, test := range []test{ + {"unnamed", ""}, + {"unnamed", "."}, + {"unnamed", ".."}, {"wiki-name", "wiki name"}, {"title.md.-", "title.md"}, {"wiki-name.-", "wiki-name"}, @@ -118,7 +121,7 @@ func TestUserWebGitPathConsistency(t *testing.T) { } userTitle := strings.TrimSpace(string(b[:l])) - if userTitle == "" || userTitle == "." { + if userTitle == "" || userTitle == "." || userTitle == ".." { continue } webPath := UserTitleToWebPath("", userTitle) |