summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorwrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68>2006-03-09 21:23:30 +0000
committerwrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68>2006-03-09 21:23:30 +0000
commit54af25de2a2c42f365d9721d273de58616d29606 (patch)
treeab28511ddea2be836f6cf24def5730df2e2ae839 /test
parent044167de5336cc5fd16300410cd4e703d1596d5f (diff)
downloadlibapr-54af25de2a2c42f365d9721d273de58616d29606.tar.gz
Proveup: Bug 38801 reported by <kevin_wise motorola.com>
Backports 382029 (wrowe), 382033 (jorton) git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/0.9.x@384621 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test')
-rw-r--r--test/testnames.c36
1 files changed, 32 insertions, 4 deletions
diff --git a/test/testnames.c b/test/testnames.c
index 9b84586f1..6ef8f6b6b 100644
--- a/test/testnames.c
+++ b/test/testnames.c
@@ -186,12 +186,39 @@ static void root_relative(CuTest *tc)
}
-#if 0
- root_result(rootpath);
- root_result(addpath);
-}
+static void root_from_cwd_and_back(CuTest *tc)
+{
+ apr_status_t rv;
+ const char *root = NULL;
+ const char *path = "//";
+ char *origpath;
+ char *testpath;
+
+ CuAssertIntEquals(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)
+ CuAssertIntEquals(tc, origpath[0], root[0]);
+ CuAssertIntEquals(tc, ':', root[1]);
+ CuAssertIntEquals(tc, '/', root[2]);
+ CuAssertIntEquals(tc, 0, root[3]);
+ CuAssertStrEquals(tc, origpath + 3, path);
+#else
+ CuAssertIntEquals(tc, APR_SUCCESS, rv);
+ CuAssertStrEquals(tc, "/", root);
+ CuAssertStrEquals(tc, origpath + 1, path);
#endif
+ rv = apr_filepath_merge(&testpath, root, path,
+ APR_FILEPATH_TRUENAME
+ | APR_FILEPATH_NOTABOVEROOT
+ | APR_FILEPATH_NOTRELATIVE, p);
+ CuAssertIntEquals(tc, APR_SUCCESS, rv);
+ CuAssertStrEquals(tc, origpath, testpath);
+}
+
+
CuSuite *testnames(void)
{
CuSuite *suite = CuSuiteNew("Path names");
@@ -208,6 +235,7 @@ CuSuite *testnames(void)
SUITE_ADD_TEST(suite, root_absolute);
SUITE_ADD_TEST(suite, root_relative);
+ SUITE_ADD_TEST(suite, root_from_cwd_and_back);
return suite;
}