Skip to content

Commit

Permalink
regress_http: basic evhttp_parse_query_str() coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
azat committed Oct 27, 2018
1 parent 8348b41 commit d161ec3
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions test/regress_http.c
Original file line number Diff line number Diff line change
Expand Up @@ -2496,6 +2496,27 @@ http_parse_query_test(void *ptr)
tt_want(validate_header(&headers, "q3", "") == 0);
evhttp_clear_headers(&headers);

end:
evhttp_clear_headers(&headers);
}
static void
http_parse_query_str_test(void *ptr)
{
struct evkeyvalq headers;
int r;

TAILQ_INIT(&headers);

r = evhttp_parse_query_str("http://www.test.com/?q=test", &headers);
tt_assert(evhttp_find_header(&headers, "q") == NULL);
tt_int_op(r, ==, 0);
evhttp_clear_headers(&headers);

r = evhttp_parse_query_str("q=test", &headers);
tt_want(validate_header(&headers, "q", "test") == 0);
tt_int_op(r, ==, 0);
evhttp_clear_headers(&headers);

end:
evhttp_clear_headers(&headers);
}
Expand Down Expand Up @@ -4804,6 +4825,7 @@ struct testcase_t http_testcases[] = {
{ "base", http_base_test, TT_FORK, NULL, NULL },
{ "bad_headers", http_bad_header_test, 0, NULL, NULL },
{ "parse_query", http_parse_query_test, 0, NULL, NULL },
{ "parse_query_str", http_parse_query_str_test, 0, NULL, NULL },
{ "parse_uri", http_parse_uri_test, 0, NULL, NULL },
{ "parse_uri_nc", http_parse_uri_test, 0, &basic_setup, (void*)"nc" },
{ "uriencode", http_uriencode_test, 0, NULL, NULL },
Expand Down

0 comments on commit d161ec3

Please sign in to comment.