You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by dr...@apache.org on 2004/06/21 17:42:34 UTC

cvs commit: apr-util/test testuri.c

dreid       2004/06/21 08:42:34

  Modified:    test     testuri.c
  Log:
  Add a test that illustrates the problem outlined by Nick Kew in
  bug # 28450.
  
  Fix the tests so we only test the things we need to, which gets the test
  passing correctly again.
  
  Revision  Changes    Path
  1.6       +25 -17    apr-util/test/testuri.c
  
  Index: testuri.c
  ===================================================================
  RCS file: /home/cvs/apr-util/test/testuri.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- testuri.c	21 Jun 2004 15:19:10 -0000	1.5
  +++ testuri.c	21 Jun 2004 15:42:34 -0000	1.6
  @@ -84,7 +84,11 @@
       {
           "http://sonyamt@[fe80::1]/filespace/?arg1=store",
           0, "http", "sonyamt@[fe80::1]", "sonyamt", NULL, "fe80::1", NULL, "/filespace/", "arg1=store", NULL, 0
  -    }
  +    },
  +    {
  +        "//www.apache.org/",
  +        0, NULL, "www.apache.org", NULL, NULL, "www.apache.org", NULL, "/", NULL, NULL, 0
  +    },
   };
   
   struct uph_test {
  @@ -166,19 +170,21 @@
           t = &aup_tests[i];
           rv = apr_uri_parse(p, t->uri, &info);
           ABTS_INT_EQUAL(tc, rv, t->rv);
  -        ABTS_STR_EQUAL(tc, info.scheme, t->scheme);
  -        ABTS_STR_EQUAL(tc, info.hostinfo, t->hostinfo);
  -        ABTS_STR_EQUAL(tc, info.user, t->user);
  -        ABTS_STR_EQUAL(tc, info.password, t->password);
  -        ABTS_STR_EQUAL(tc, info.hostname, t->hostname);
  -        ABTS_STR_EQUAL(tc, info.port_str, t->port_str);
  -        ABTS_STR_EQUAL(tc, info.path, t->path);
  -        ABTS_STR_EQUAL(tc, info.query, t->query);
  -        ABTS_STR_EQUAL(tc, info.user, t->user);
  -        ABTS_INT_EQUAL(tc, info.port, t->port);
  -
  -        s = apr_uri_unparse(p, &info, APR_URI_UNP_REVEALPASSWORD);
  -        ABTS_STR_EQUAL(tc, s, t->uri);
  +        if (t->rv == APR_SUCCESS) {
  +            ABTS_STR_EQUAL(tc, info.scheme, t->scheme);
  +            ABTS_STR_EQUAL(tc, info.hostinfo, t->hostinfo);
  +            ABTS_STR_EQUAL(tc, info.user, t->user);
  +            ABTS_STR_EQUAL(tc, info.password, t->password);
  +            ABTS_STR_EQUAL(tc, info.hostname, t->hostname);
  +            ABTS_STR_EQUAL(tc, info.port_str, t->port_str);
  +            ABTS_STR_EQUAL(tc, info.path, t->path);
  +            ABTS_STR_EQUAL(tc, info.query, t->query);
  +            ABTS_STR_EQUAL(tc, info.user, t->user);
  +            ABTS_INT_EQUAL(tc, info.port, t->port);
  +
  +            s = apr_uri_unparse(p, &info, APR_URI_UNP_REVEALPASSWORD);
  +            ABTS_STR_EQUAL(tc, s, t->uri);
  +        }
       }
   }
   
  @@ -197,9 +203,11 @@
           t = &uph_tests[i];
           rv = apr_uri_parse_hostinfo(p, t->hostinfo, &info);
           ABTS_INT_EQUAL(tc, rv, t->rv);
  -        ABTS_STR_EQUAL(tc, info.hostname, t->hostname);
  -        ABTS_STR_EQUAL(tc, info.port_str, t->port_str);
  -        ABTS_INT_EQUAL(tc, info.port, t->port);
  +        if (t->rv == APR_SUCCESS) {
  +            ABTS_STR_EQUAL(tc, info.hostname, t->hostname);
  +            ABTS_STR_EQUAL(tc, info.port_str, t->port_str);
  +            ABTS_INT_EQUAL(tc, info.port, t->port);
  +        }
       }
   }