Code

parser_test: Check operator precedence.
authorSebastian Harl <sh@tokkee.org>
Sun, 6 Apr 2014 11:38:27 +0000 (13:38 +0200)
committerSebastian Harl <sh@tokkee.org>
Sun, 6 Apr 2014 11:38:27 +0000 (13:38 +0200)
t/frontend/parser_test.c

index 20596eec38820d949a40ffc22279fd120f860955..705e7322370ee370fb0d3c2434f85a5668d44cb4 100644 (file)
@@ -140,6 +140,20 @@ START_TEST(test_parse_matcher)
                { "host.name =~ 'pattern' OR "
                  "service.name =~ 'pattern'",      -1,  MATCHER_OR },
 
+               /* check operator precedence */
+               { "host.name = 'name' OR "
+                 "service.name = 'name' AND "
+                 "attribute.name = 'name' OR "
+                 "attribute.foo = 'bar'",          -1,  MATCHER_OR },
+               { "host.name = 'name' AND "
+                 "service.name = 'name' AND "
+                 "attribute.name = 'name' OR "
+                 "attribute.foo = 'bar'",          -1,  MATCHER_OR },
+               { "host.name = 'name' AND "
+                 "service.name = 'name' OR "
+                 "attribute.name = 'name' AND "
+                 "attribute.foo = 'bar'",          -1,  MATCHER_OR },
+
                /* syntax errors */
                { "LIST",                           -1, -1 },
                { "foo &^ bar",                     -1, -1 },