1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-07-22 17:18:37 +00:00

Validate Keep list and Block list rules syntax

This commit is contained in:
Frédéric Guillot 2021-02-07 18:38:45 -08:00 committed by fguillot
parent 05fd83bd6f
commit e8d0360e64
19 changed files with 173 additions and 23 deletions

View file

@ -14,7 +14,7 @@ func TestIsValidURL(t *testing.T) {
}
for link, expected := range scenarios {
result := isValidURL(link)
result := IsValidURL(link)
if result != expected {
t.Errorf(`Unexpected result, got %v instead of %v`, result, expected)
}
@ -46,3 +46,17 @@ func TestValidateDirection(t *testing.T) {
t.Error(`An invalid direction should generate a error`)
}
}
func TestIsValidRegex(t *testing.T) {
scenarios := map[string]bool{
"(?i)miniflux": true,
"[": false,
}
for expr, expected := range scenarios {
result := IsValidRegex(expr)
if result != expected {
t.Errorf(`Unexpected result, got %v instead of %v`, result, expected)
}
}
}