X-Git-Url: https://git.tokkee.org/?p=sysdb.git;a=blobdiff_plain;f=t%2Funit%2Fparser%2Fparser_test.c;h=cfc36fc36417610175455f3e7bef2a8cc844b7c6;hp=f9049211440c513c342ce6c3769c7f160f8767bf;hb=2a5aff78eb32778a27b707aa99a2494b1371a5dd;hpb=a46915cabd4fd110fb20ba7bf09cfe1fb14456e1 diff --git a/t/unit/parser/parser_test.c b/t/unit/parser/parser_test.c index f904921..cfc36fc 100644 --- a/t/unit/parser/parser_test.c +++ b/t/unit/parser/parser_test.c @@ -357,6 +357,20 @@ struct { { "LOOKUP hosts MATCHING " "name < ''", -1, 1, SDB_AST_TYPE_LOOKUP, SDB_HOST }, + /* typed expressions */ + { "LOOKUP services MATCHING " + "host.attribute['a'] = 'a'", + -1, 1, SDB_AST_TYPE_LOOKUP, SDB_SERVICE }, + /* TODO: this should work but the analyzer currently sees ATTRIBUTE + * (instead of SERVICE-ATTRIBUTE) as the child type + { "LOOKUP services MATCHING " + "ANY attribute.service.name = 's'", + -1, 1, SDB_AST_TYPE_LOOKUP, SDB_SERVICE }, + */ + { "LOOKUP hosts MATCHING " + "ANY service.service.name = 's'", + -1, 1, SDB_AST_TYPE_LOOKUP, SDB_HOST }, + /* NULL */ { "LOOKUP hosts MATCHING " "attribute['foo'] " @@ -422,6 +436,8 @@ struct { "value = 'a'", -1, -1, 0, 0 }, { "LIST metrics FILTER " "value = 'a'", -1, -1, 0, 0 }, + { "LIST metrics FILTER " + "name.1 = 'a'", -1, -1, 0, 0 }, /* type mismatches */ { "LOOKUP hosts MATCHING " @@ -431,11 +447,6 @@ struct { "1 IN backend ", -1, -1, 0, 0 }, { "LOOKUP hosts MATCHING " "1 NOT IN backend ", -1, -1, 0, 0 }, - { "LOOKUP hosts MATCHING " - "ANY backend !~ backend", - -1, -1, 0, 0 }, - { "LOOKUP hosts MATCHING " - "ANY backend = 1", -1, -1, 0, 0 }, { "LOOKUP hosts MATCHING " "age > 0", -1, -1, 0, 0 }, { "LOOKUP hosts MATCHING " @@ -518,8 +529,23 @@ struct { "name + 1 IS NULL", -1, -1, 0, 0 }, { "LOOKUP hosts FILTER " "name + 1 IS NULL", -1, -1, 0, 0 }, + + /* invalid iterators */ + { "LOOKUP hosts MATCHING " + "ANY backend !~ backend", + -1, -1, 0, 0 }, + { "LOOKUP hosts MATCHING " + "ANY backend = 1", -1, -1, 0, 0 }, { "LOOKUP hosts MATCHING " "ANY 'patt' =~ 'p'", -1, -1, 0, 0 }, + { "LOOKUP hosts MATCHING " + "ALL 1 || '2' < '3'", -1, -1, 0, 0 }, + { "LOOKUP hosts MATCHING " + "ALL name =~ 'a'", -1, -1, 0, 0 }, + /* this could work in theory but is not supported atm */ + { "LOOKUP hosts MATCHING " + "ANY backend || 'a' = 'b'", + -1, -1, 0, 0 }, /* invalid LIST commands */ { "LIST", -1, -1, 0, 0 },