aboutsummaryrefslogtreecommitdiff
path: root/staging/adblock/test/rule.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'staging/adblock/test/rule.cpp')
-rw-r--r--staging/adblock/test/rule.cpp32
1 files changed, 18 insertions, 14 deletions
diff --git a/staging/adblock/test/rule.cpp b/staging/adblock/test/rule.cpp
index 31af7d5..07186b9 100644
--- a/staging/adblock/test/rule.cpp
+++ b/staging/adblock/test/rule.cpp
@@ -8,6 +8,8 @@ SCENARIO("MatcherRule")
{
GIVEN("options with case sensitive pattern")
{
+ const QString defaultUrl = "";
+
const Options opt { .matchcase=true };
const QString patternContains("this string contains the pattern in it");
const QString patternBegins("pattern starts this string");
@@ -21,10 +23,10 @@ SCENARIO("MatcherRule")
THEN("pattern is matched anywhere in the URL")
{
- REQUIRE(rule.hasMatch(&patternContains));
- REQUIRE(rule.hasMatch(&patternBegins));
- REQUIRE(rule.hasMatch(&patternEnds));
- REQUIRE(!rule.hasMatch(&patternMissing));
+ REQUIRE(rule.hasMatch(&patternContains, &defaultUrl, &defaultUrl));
+ REQUIRE(rule.hasMatch(&patternBegins, &defaultUrl, &defaultUrl));
+ REQUIRE(rule.hasMatch(&patternEnds, &defaultUrl, &defaultUrl));
+ REQUIRE(!rule.hasMatch(&patternMissing, &defaultUrl, &defaultUrl));
}
}
@@ -35,10 +37,10 @@ SCENARIO("MatcherRule")
THEN("pattern is matched if at the start of the URL")
{
- REQUIRE(!rule.hasMatch(&patternContains));
- REQUIRE(rule.hasMatch(&patternBegins));
- REQUIRE(!rule.hasMatch(&patternEnds));
- REQUIRE(!rule.hasMatch(&patternMissing));
+ REQUIRE(!rule.hasMatch(&patternContains, &defaultUrl, &defaultUrl));
+ REQUIRE(rule.hasMatch(&patternBegins, &defaultUrl, &defaultUrl));
+ REQUIRE(!rule.hasMatch(&patternEnds, &defaultUrl, &defaultUrl));
+ REQUIRE(!rule.hasMatch(&patternMissing, &defaultUrl, &defaultUrl));
}
}
@@ -49,10 +51,10 @@ SCENARIO("MatcherRule")
THEN("pattern is matched if at the end of the URL")
{
- REQUIRE(!rule.hasMatch(&patternContains));
- REQUIRE(!rule.hasMatch(&patternBegins));
- REQUIRE(rule.hasMatch(&patternEnds));
- REQUIRE(!rule.hasMatch(&patternMissing));
+ REQUIRE(!rule.hasMatch(&patternContains, &defaultUrl, &defaultUrl));
+ REQUIRE(!rule.hasMatch(&patternBegins, &defaultUrl, &defaultUrl));
+ REQUIRE(rule.hasMatch(&patternEnds, &defaultUrl, &defaultUrl));
+ REQUIRE(!rule.hasMatch(&patternMissing, &defaultUrl, &defaultUrl));
}
}
}
@@ -62,6 +64,8 @@ SCENARIO("RegexRule")
{
GIVEN("options with case sensitive pattern")
{
+ const QString defaultUrl;
+
const Options opt { .matchcase=true };
const QString patternContains("this string contains the pattern in it");
const QString patternMissing("and this one does not");
@@ -73,8 +77,8 @@ SCENARIO("RegexRule")
THEN("pattern is matched anywhere in the URL")
{
- REQUIRE(rule.hasMatch(&patternContains));
- REQUIRE(!rule.hasMatch(&patternMissing));
+ REQUIRE(rule.hasMatch(&patternContains, &defaultUrl, &defaultUrl));
+ REQUIRE(!rule.hasMatch(&patternMissing, &defaultUrl, &defaultUrl));
}
}
}