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.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/staging/adblock/test/rule.cpp b/staging/adblock/test/rule.cpp
index d192601..31af7d5 100644
--- a/staging/adblock/test/rule.cpp
+++ b/staging/adblock/test/rule.cpp
@@ -2,11 +2,13 @@
#include "rule.h"
#include <catch2/catch.hpp>
+using namespace AdblockPlus;
+
SCENARIO("MatcherRule")
{
GIVEN("options with case sensitive pattern")
{
- const AdblockPlus::Options opt { .matchcase=true };
+ const Options opt { .matchcase=true };
const QString patternContains("this string contains the pattern in it");
const QString patternBegins("pattern starts this string");
const QString patternEnds("this string ends with pattern");
@@ -14,7 +16,7 @@ SCENARIO("MatcherRule")
WHEN("contains")
{
- AdblockPlus::MatcherRule rule("pattern", opt);
+ MatcherRule rule("pattern", opt);
REQUIRE(rule.shouldBlock());
THEN("pattern is matched anywhere in the URL")
@@ -28,7 +30,7 @@ SCENARIO("MatcherRule")
WHEN("startsWith")
{
- AdblockPlus::MatcherRule rule("pattern", opt, AdblockPlus::MatcherRule::UrlStartsWith);
+ MatcherRule rule("pattern", opt, MatcherRule::UrlStartsWith);
REQUIRE(rule.shouldBlock());
THEN("pattern is matched if at the start of the URL")
@@ -42,7 +44,7 @@ SCENARIO("MatcherRule")
WHEN("endsWith")
{
- AdblockPlus::MatcherRule rule("pattern", opt, AdblockPlus::MatcherRule::UrlEndsWith);
+ MatcherRule rule("pattern", opt, MatcherRule::UrlEndsWith);
REQUIRE(rule.shouldBlock());
THEN("pattern is matched if at the end of the URL")
@@ -60,13 +62,13 @@ SCENARIO("RegexRule")
{
GIVEN("options with case sensitive pattern")
{
- const AdblockPlus::Options opt { .matchcase=true };
+ const Options opt { .matchcase=true };
const QString patternContains("this string contains the pattern in it");
const QString patternMissing("and this one does not");
WHEN("contains")
{
- AdblockPlus::RegexRule rule("pattern", opt);
+ RegexRule rule("pattern", opt);
REQUIRE(rule.shouldBlock());
THEN("pattern is matched anywhere in the URL")