apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jor...@apache.org
Subject svn commit: r1813330 - /apr/apr/trunk/test/testipsub.c
Date Wed, 25 Oct 2017 18:07:03 GMT
Author: jorton
Date: Wed Oct 25 18:07:03 2017
New Revision: 1813330

URL: http://svn.apache.org/viewvc?rev=1813330&view=rev
Log:
* test/testipsub.c (test_parse_addr_port): More tests.

Modified:
    apr/apr/trunk/test/testipsub.c

Modified: apr/apr/trunk/test/testipsub.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/test/testipsub.c?rev=1813330&r1=1813329&r2=1813330&view=diff
==============================================================================
--- apr/apr/trunk/test/testipsub.c (original)
+++ apr/apr/trunk/test/testipsub.c Wed Oct 25 18:07:03 2017
@@ -173,18 +173,25 @@ static void test_parse_addr_port(abts_ca
         const char *addr, *scope_id;
         apr_port_t port;
     } *test, testcases[] = {
+        /* Success cases */
         { "localhost:80", APR_SUCCESS, "localhost", NULL, 80 }
+        ,{ "localhost", APR_SUCCESS, "localhost", NULL, 0 }
         ,{ "www.example.com:8080", APR_SUCCESS, "www.example.com", NULL, 8080 }
         ,{ "w:1", APR_SUCCESS, "w", NULL, 1 }
         ,{ "127.0.0.1:80", APR_SUCCESS, "127.0.0.1", NULL, 80 }
         ,{ "[::]:80", APR_SUCCESS, "::", NULL, 80 }
+        ,{ "[::%eth0]:80", APR_SUCCESS, "::", "eth0", 80 }
+        ,{ "[::%eth0]", APR_SUCCESS, "::", "eth0", 0 }
+        ,{ "8080", APR_SUCCESS, NULL, NULL, 8080 } /* API doc has this case */
+
+        /* Failure cases */
         ,{ "localhost:999999", APR_EINVAL, NULL, NULL, 0 }
         ,{ "localhost:0", APR_EINVAL, NULL, NULL, 0 }
+        ,{ "[abc]", APR_EINVAL, NULL, NULL, 0 }
         ,{ "[::]z:80", APR_EINVAL, NULL, NULL, 0 }
         ,{ "[:::80", APR_EINVAL, NULL, NULL, 0 }
         ,{ "[zzzz]:80", APR_EINVAL, NULL, NULL, 0 }
         ,{ "[::%]:80", APR_EINVAL, NULL, NULL, 0 }
-        ,{ "[::%eth0]:80", APR_SUCCESS, "::", "eth0", 80 }
 /*        ,{ "127.0.0.1:80x", APR_EINVAL, NULL, NULL, 0 }  <- should fail, doesn't  */
 /*        ,{ "127.0.0.1x:80", APR_EINVAL, NULL, NULL, 0 }  <- maybe should fail?, doesn't
 */
 /*        ,{ "localhost:-1", APR_EINVAL, NULL, NULL, 0 }   <- should fail, doesn't */



Mime
View raw message