X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=test%2Ftest_comstack.c;h=381ecb88f79dbbe54e8a9d635046f75997f90e51;hp=fedf567f5048c42dec1c4afc4ff3b26d5d0bf87f;hb=5921175c5859c16c2ba411999831b8aaf64917b4;hpb=d51b21c6f41a021f21078921a0de50106264d55e diff --git a/test/test_comstack.c b/test/test_comstack.c index fedf567..381ecb8 100644 --- a/test/test_comstack.c +++ b/test/test_comstack.c @@ -266,6 +266,33 @@ static int comstack_example(const char *server_address_str) return 0; } +static void tst_cs_get_host_args(void) +{ + const char *arg = 0; + + cs_get_host_args("http://localhost:9999", &arg); + YAZ_CHECK(arg && !strcmp(arg, "")); + cs_get_host_args("http://localhost:9999/x", &arg); + YAZ_CHECK(arg && !strcmp(arg, "x")); + cs_get_host_args("http://localhost:9999?x", &arg); + YAZ_CHECK(arg && !strcmp(arg, "")); + cs_get_host_args("localhost:9999", &arg); + YAZ_CHECK(arg && !strcmp(arg, "")); + cs_get_host_args("localhost:9999/", &arg); + YAZ_CHECK(arg && !strcmp(arg, "")); + cs_get_host_args("localhost:9999/x&url=http://some.host", &arg); + YAZ_CHECK(arg && !strcmp(arg, "x&url=http://some.host")); + cs_get_host_args("http://localhost:9999/x&url=http://some.host", &arg); + YAZ_CHECK(arg && !strcmp(arg, "x&url=http://some.host")); + cs_get_host_args("http:/localhost:9999/x", &arg); + YAZ_CHECK(arg && !strcmp(arg, "localhost:9999/x")); + cs_get_host_args("http//localhost:9999/x", &arg); + YAZ_CHECK(arg && !strcmp(arg, "/localhost:9999/x")); + cs_get_host_args("http://y/x", &arg); + YAZ_CHECK(arg && !strcmp(arg, "x")); + cs_get_host_args("http:///x", &arg); + YAZ_CHECK(arg && !strcmp(arg, "x")); +} int main (int argc, char **argv) { @@ -275,6 +302,7 @@ int main (int argc, char **argv) comstack_example(argv[1]); tst_http_request(); tst_http_response(); + tst_cs_get_host_args(); YAZ_CHECK_TERM; }