mirror of
https://github.com/go-gitea/gitea
synced 2025-07-05 01:57:20 +00:00
Disallow empty titles (#5785)
* add util method and tests * make sure the title of an issue cannot be empty * wiki title cannot be empty * pull request title cannot be empty * update to make use of the new util methof
This commit is contained in:
@ -77,3 +77,20 @@ func TestIsExternalURL(t *testing.T) {
|
||||
assert.Equal(t, test.Expected, IsExternalURL(test.RawURL))
|
||||
}
|
||||
}
|
||||
|
||||
func TestIsEmptyString(t *testing.T) {
|
||||
|
||||
cases := []struct {
|
||||
s string
|
||||
expected bool
|
||||
}{
|
||||
{"", true},
|
||||
{" ", true},
|
||||
{" ", true},
|
||||
{" a", false},
|
||||
}
|
||||
|
||||
for _, v := range cases {
|
||||
assert.Equal(t, v.expected, IsEmptyString(v.s))
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user