You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by wr...@apache.org on 2016/01/27 21:11:04 UTC

svn commit: r1727175 - /apr/apr/trunk/test/teststr.c

Author: wrowe
Date: Wed Jan 27 20:11:03 2016
New Revision: 1727175

URL: http://svn.apache.org/viewvc?rev=1727175&view=rev
Log:
Add ivan's r1612823 test cases for apr_cstr_skip_prefix

Found no other svn_cstring_ test cases to import, so skipping
the creation of a testcstr.c module for the time being.


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

Modified: apr/apr/trunk/test/teststr.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/test/teststr.c?rev=1727175&r1=1727174&r2=1727175&view=diff
==============================================================================
--- apr/apr/trunk/test/teststr.c (original)
+++ apr/apr/trunk/test/teststr.c Wed Jan 27 20:11:03 2016
@@ -382,6 +382,17 @@ static void snprintf_overflow(abts_case
     ABTS_TRUE(tc, buf[2] == '4' && buf[3] == '2');
 }
 
+static void skip_prefix(abts_case *tc, void *data)
+{
+    ABTS_STR_EQUAL(tc, apr_cstr_skip_prefix("12345", "12345"), "");
+    ABTS_STR_EQUAL(tc, apr_cstr_skip_prefix("12345", "123"),   "45");
+    ABTS_STR_EQUAL(tc, apr_cstr_skip_prefix("12345", ""),      "12345");
+    ABTS_STR_EQUAL(tc, apr_cstr_skip_prefix("12345", "23"),    NULL);
+    ABTS_STR_EQUAL(tc, apr_cstr_skip_prefix("1",     "12"),    NULL);
+    ABTS_STR_EQUAL(tc, apr_cstr_skip_prefix("",      ""),      "");
+    ABTS_STR_EQUAL(tc, apr_cstr_skip_prefix("",      "12"),    NULL);
+}
+
 abts_suite *teststr(abts_suite *suite)
 {
     suite = ADD_SUITE(suite)
@@ -399,6 +410,7 @@ abts_suite *teststr(abts_suite *suite)
     abts_run_test(suite, string_strfsize, NULL);
     abts_run_test(suite, string_cpystrn, NULL);
     abts_run_test(suite, snprintf_overflow, NULL);
+    abts_run_test(suite, skip_prefix, NULL);
 
     return suite;
 }