summaryrefslogtreecommitdiff
path: root/test/testfilecopy.c
diff options
context:
space:
mode:
authorBojan Smojver <bojan@apache.org>2008-07-25 00:17:04 +0000
committerBojan Smojver <bojan@apache.org>2008-07-25 00:17:04 +0000
commite8957cc62709498baced8306437be67a91c46303 (patch)
tree31bec45d0db517020fac20f3aca541ab72c7954a /test/testfilecopy.c
parent4927c82930004283fdcdccf39e26f500590ecea8 (diff)
downloadapr-e8957cc62709498baced8306437be67a91c46303.tar.gz
Add apr_file_link() function.
PR 44841. Patch by Mark Heily <mark heily.com> git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@679630 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test/testfilecopy.c')
-rw-r--r--test/testfilecopy.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/testfilecopy.c b/test/testfilecopy.c
index 5b64bc053..f1a64f1f8 100644
--- a/test/testfilecopy.c
+++ b/test/testfilecopy.c
@@ -123,6 +123,23 @@ static void append_exist(abts_case *tc, void *data)
APR_ASSERT_SUCCESS(tc, "Couldn't remove copy file", rv);
}
+static void link_existing(abts_case *tc, void *data)
+{
+ apr_status_t rv;
+
+ rv = apr_file_link("data/file_datafile.txt", "data/file_datafile2.txt");
+ apr_file_remove("data/file_datafile2.txt", p);
+ ABTS_ASSERT(tc, "Couldn't create hardlink to file", rv == APR_SUCCESS);
+}
+
+static void link_nonexisting(abts_case *tc, void *data)
+{
+ apr_status_t rv;
+
+ rv = apr_file_link("data/does_not_exist.txt", "data/fake.txt");
+ ABTS_ASSERT(tc, "", rv != APR_SUCCESS);
+}
+
abts_suite *testfilecopy(abts_suite *suite)
{
suite = ADD_SUITE(suite)
@@ -133,6 +150,9 @@ abts_suite *testfilecopy(abts_suite *suite)
abts_run_test(suite, append_nonexist, NULL);
abts_run_test(suite, append_exist, NULL);
+ abts_run_test(suite, link_existing, NULL);
+ abts_run_test(suite, link_nonexisting, NULL);
+
return suite;
}