summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/style/filter.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/style/filter.cpp b/test/style/filter.cpp
index da0e5ff4a3..f258c31492 100644
--- a/test/style/filter.cpp
+++ b/test/style/filter.cpp
@@ -114,3 +114,25 @@ TEST(Filter, None) {
ASSERT_FALSE(evaluate(parse("[\"none\", [\"==\", \"foo\", 0], [\"==\", \"foo\", 1]]"),
{{ std::string("foo"), int64_t(1) }}));
}
+
+TEST(Filter, Has) {
+ ASSERT_TRUE(evaluate(parse("[\"has\", \"foo\"]"),
+ {{ std::string("foo"), int64_t(1) }}));
+ ASSERT_TRUE(evaluate(parse("[\"has\", \"foo\"]"),
+ {{ std::string("foo"), int64_t(0) }}));
+ ASSERT_TRUE(evaluate(parse("[\"has\", \"foo\"]"),
+ {{ std::string("foo"), false }}));
+ ASSERT_FALSE(evaluate(parse("[\"has\", \"foo\"]"),
+ {{}}));
+}
+
+TEST(Filter, NotHas) {
+ ASSERT_FALSE(evaluate(parse("[\"!has\", \"foo\"]"),
+ {{ std::string("foo"), int64_t(1) }}));
+ ASSERT_FALSE(evaluate(parse("[\"!has\", \"foo\"]"),
+ {{ std::string("foo"), int64_t(0) }}));
+ ASSERT_FALSE(evaluate(parse("[\"!has\", \"foo\"]"),
+ {{ std::string("foo"), false }}));
+ ASSERT_TRUE(evaluate(parse("[\"!has\", \"foo\"]"),
+ {{}}));
+}