diff options
| author | wrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68> | 2006-03-01 14:28:46 +0000 |
|---|---|---|
| committer | wrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68> | 2006-03-01 14:28:46 +0000 |
| commit | 4798ac76528cbb9fc53c754d75d1b9ec5a8f2a06 (patch) | |
| tree | 97cfc3df7a7996ce292b051392f86b8c9e4e3ea9 | |
| parent | 2d222de34b69aa69619af238be8a4c31088085a9 (diff) | |
| download | libapr-4798ac76528cbb9fc53c754d75d1b9ec5a8f2a06.tar.gz | |
Proveup: Bug 38801 reported by <kevin_wise motorola.com>
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@382029 13f79535-47bb-0310-9956-ffa450edef68
| -rw-r--r-- | test/testnames.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/test/testnames.c b/test/testnames.c index d949df2ea..386da8c00 100644 --- a/test/testnames.c +++ b/test/testnames.c @@ -203,6 +203,38 @@ static void root_from_slash(abts_case *tc, void *data) ABTS_STR_EQUAL(tc, "", path); } +static void root_from_cwd_and_back(abts_case *tc, void *data) +{ + apr_status_t rv; + const char *root = NULL; + const char *path = "//"; + char *origpath; + char *testpath; + + ABTS_INT_EQUAL(tc, APR_SUCCESS, apr_filepath_get(&origpath, 0, p)); + path = origpath; + rv = apr_filepath_root(&root, &path, APR_FILEPATH_TRUENAME, p); + +#if defined(WIN32) || defined(OS2) + ABTS_INT_EQUAL(tc, origpath[0], root[0]); + ABTS_INT_EQUAL(tc, ':', root[1]); + ABTS_INT_EQUAL(tc, '/', root[2]); + ABTS_INT_EQUAL(tc, 0, root[3]); + ABTS_STR_EQUAL(tc, origpath + 3, path); +#else + ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); + ABTS_STR_EQUAL(tc, '/', root); + ABTS_STR_EQUAL(tc, origpath + 1, path); +#endif + + rv = apr_filepath_merge(&testpath, root, path, + APR_FILEPATH_TRUENAME + | APR_FILEPATH_NOTABOVEROOT + | APR_FILEPATH_NOTRELATIVE, p); + ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); + ABTS_STR_EQUAL(tc, origpath, testpath); +} + abts_suite *testnames(abts_suite *suite) { @@ -221,6 +253,7 @@ abts_suite *testnames(abts_suite *suite) abts_run_test(suite, root_absolute, NULL); abts_run_test(suite, root_relative, NULL); abts_run_test(suite, root_from_slash, NULL); + abts_run_test(suite, root_from_cwd_and_back, NULL); return suite; } |
