Skip to content

Commit

Permalink
frontend: Updated unit-tests for expression related parsing.
Browse files Browse the repository at this point in the history
  • Loading branch information
tokkee committed Apr 5, 2014
1 parent c63a274 commit ddb6411
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions t/frontend/parser_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ START_TEST(test_parse)
{ "LIST;", -1, 1, CONNECTION_LIST },
{ "LIST; INVALID", 5, 1, CONNECTION_LIST },

{ "LOOKUP hosts "
"WHERE 'host'", -1, 1, CONNECTION_LOOKUP },
{ "LOOKUP hosts WHERE "
"host.name = 'host'", -1, 1, CONNECTION_LOOKUP },

/* comments */
{ "/* some comment */", -1, 0, 0 },
Expand All @@ -71,8 +71,8 @@ START_TEST(test_parse)
{ "/* some incomplete", -1, -1, 0 },

{ "LOOKUP hosts", -1, -1, 0 },
{ "LOOKUP invalid "
"WHERE 'host'", -1, -1, 0 },
{ "LOOKUP foo WHERE "
"host.name = 'host'", -1, -1, 0 },
};

size_t i;
Expand Down Expand Up @@ -120,17 +120,17 @@ START_TEST(test_parse_matcher)
int expected;
} golden_data[] = {
/* empty expressions */
{ NULL, -1, -1 },
{ "", -1, -1 },
{ NULL, -1, -1 },
{ "", -1, -1 },

/* valid expressions */
{ "'localhost'", -1, 0 },
{ "'localhost' -- foo", -1, 0 },
{ "'host' <garbage>", 6, 0 },
{ "host.name = 'localhost'", -1, 0 },
{ "host.name = 'localhost' -- foo", -1, 0 },
{ "host.name = 'host' <garbage>", 18, 0 },

/* syntax errors */
{ "LIST", -1, -1 },
{ "foo &^ bar", -1, -1 },
{ "LIST", -1, -1 },
{ "foo &^ bar", -1, -1 },
};

size_t i;
Expand Down

0 comments on commit ddb6411

Please sign in to comment.