Merge pull request #6051 from dgquintas/moar_uri_tests

added more uri parsing tests
pull/6042/head
Jan Tattermusch 9 years ago
commit 00eef19acd
  1. 17
      test/core/client_config/uri_parser_test.c

@ -88,6 +88,23 @@ static void test_query_parts() {
GPR_ASSERT(0 == strcmp("frag", uri->fragment));
grpc_uri_destroy(uri);
}
{
/* test the current behavior of multiple query part values */
const char *uri_text = "http://auth/path?foo=bar=baz&foobar==";
grpc_uri *uri = grpc_uri_parse(uri_text, 0);
GPR_ASSERT(uri);
GPR_ASSERT(0 == strcmp("http", uri->scheme));
GPR_ASSERT(0 == strcmp("auth", uri->authority));
GPR_ASSERT(0 == strcmp("/path", uri->path));
GPR_ASSERT(0 == strcmp("foo=bar=baz&foobar==", uri->query));
GPR_ASSERT(2 == uri->num_query_parts);
GPR_ASSERT(0 == strcmp("bar", grpc_uri_get_query_arg(uri, "foo")));
GPR_ASSERT(0 == strcmp("", grpc_uri_get_query_arg(uri, "foobar")));
grpc_uri_destroy(uri);
}
{
/* empty query */
const char *uri_text = "http://foo/path";

Loading…
Cancel
Save