aboutsummaryrefslogtreecommitdiff
path: root/staging/adblock/test/rule.cpp
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2020-04-16 22:09:58 +0300
committerAqua-sama <aqua@iserlohn-fortress.net>2020-04-21 20:14:57 +0300
commit908ab1e805d98cd79a36ba6bda3c3a9c8d0a99ca (patch)
treecda8739eba52457b605c38f7d71489f5556d0b26 /staging/adblock/test/rule.cpp
parentAdd some Options tests (diff)
downloadsmolbote-908ab1e805d98cd79a36ba6bda3c3a9c8d0a99ca.tar.xz
Parse type options into std::bitset
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")