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:
parent
05fd83bd6f
commit
e8d0360e64
19 changed files with 173 additions and 23 deletions
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue