src/url_test.c
changeset 17 0a024b29b16d
parent 16 74fb62022fb3
child 18 b12e78767248
equal deleted inserted replaced
16:74fb62022fb3 17:0a024b29b16d
     5 
     5 
     6 #include "lib/url.h"
     6 #include "lib/url.h"
     7 
     7 
     8 #define FAIL(...) do { printf("FAIL: "); printf(__VA_ARGS__); printf("\n"); return -1; } while (0)
     8 #define FAIL(...) do { printf("FAIL: "); printf(__VA_ARGS__); printf("\n"); return -1; } while (0)
     9 
     9 
    10 struct url_schema basic_http = { 1, { "http" } };
    10 struct url_schema
       
    11     basic_http = { 1, { "http" } },
       
    12     svn_ssh = { 2, { "svn", "ssh" } };
    11 
    13 
    12 struct url_test {
    14 struct url_test {
    13     const char *url;
    15     const char *url;
    14     const struct url expected;
    16     const struct url expected;
    15 } url_tests[] = {
    17 } url_tests[] = {
    17         NULL, NULL, NULL, "localhost", "http", NULL, NULL
    19         NULL, NULL, NULL, "localhost", "http", NULL, NULL
    18     } },
    20     } },
    19 
    21 
    20     {   "http://example.com/path",  {
    22     {   "http://example.com/path",  {
    21         &basic_http, NULL, NULL, "example.com", NULL, "path", NULL 
    23         &basic_http, NULL, NULL, "example.com", NULL, "path", NULL 
       
    24     } },
       
    25 
       
    26     {   "svn+ssh://user:passwd@someplace:someport/something",   {
       
    27         &svn_ssh, "user", "passwd", "someplace", "someport", "something"
       
    28     } },
       
    29 
       
    30     {   "user@:service/",   {
       
    31         NULL, "user", NULL, NULL, "service", NULL
    22     } },
    32     } },
    23     
    33     
    24     {   NULL,               {   } },
    34     {   NULL,               {   } },
    25 };
    35 };
    26 
    36