diff options
Diffstat (limited to 'staging/adblock/test/filterlist.cpp')
-rw-r--r-- | staging/adblock/test/filterlist.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/staging/adblock/test/filterlist.cpp b/staging/adblock/test/filterlist.cpp index 4366489..262e84b 100644 --- a/staging/adblock/test/filterlist.cpp +++ b/staging/adblock/test/filterlist.cpp @@ -91,3 +91,18 @@ TEST_CASE("string ends with") REQUIRE(!rule->hasMatch(&allows)); delete rule; } + +TEST_CASE("regular expressions") +{ + auto *rule = FilterList::parseRule("/banner\\d+/"); + const QString matches1 = "banner123"; + const QString matches2 = "banner321"; + + const QString ignores = "banners"; + + REQUIRE(rule->hasMatch(&matches1)); + REQUIRE(rule->hasMatch(&matches2)); + REQUIRE(!rule->hasMatch(&ignores)); + delete rule; +} + |