[Pkg-owncloud-commits] [owncloud-client] 132/219: tests: Add a csync exclude test to check toplevel excludes.

Sandro Knauß hefee-guest at moszumanska.debian.org
Sat Oct 11 14:43:18 UTC 2014


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository owncloud-client.

commit fc36e7eccf132eb0cda76ee41b2db85376d42c86
Author: Klaas Freitag <freitag at owncloud.com>
Date:   Thu Sep 18 15:33:44 2014 +0200

    tests: Add a csync exclude test to check toplevel excludes.
---
 csync/tests/csync_tests/check_csync_exclude.c | 33 +++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/csync/tests/csync_tests/check_csync_exclude.c b/csync/tests/csync_tests/check_csync_exclude.c
index 50c8780..1d216eb 100644
--- a/csync/tests/csync_tests/check_csync_exclude.c
+++ b/csync/tests/csync_tests/check_csync_exclude.c
@@ -141,6 +141,38 @@ static void check_csync_excluded(void **state)
 
 }
 
+static void check_csync_pathes(void **state)
+{
+    CSYNC *csync = *state;
+    int rc;
+
+    _csync_exclude_add( &(csync->excludes), "/exclude" );
+
+    /* Check toplevel dir, the pattern only works for toplevel dir. */
+    rc = csync_excluded(csync, "/exclude", CSYNC_FTW_TYPE_DIR);
+    assert_int_equal(rc, CSYNC_FILE_EXCLUDE_LIST);
+
+    rc = csync_excluded(csync, "/foo/exclude", CSYNC_FTW_TYPE_DIR);
+    assert_int_equal(rc, CSYNC_NOT_EXCLUDED);
+
+    /* check for a file called exclude. Must still work */
+    rc = csync_excluded(csync, "/exclude", CSYNC_FTW_TYPE_FILE);
+    assert_int_equal(rc, CSYNC_FILE_EXCLUDE_LIST);
+
+    rc = csync_excluded(csync, "/foo/exclude", CSYNC_FTW_TYPE_FILE);
+    assert_int_equal(rc, CSYNC_NOT_EXCLUDED);
+
+    /* Add an exclude for directories only: excl/ */
+    _csync_exclude_add( &(csync->excludes), "excl/" );
+    rc = csync_excluded(csync, "/excl", CSYNC_FTW_TYPE_DIR);
+    assert_int_equal(rc, CSYNC_FILE_EXCLUDE_LIST);
+
+    rc = csync_excluded(csync, "meep/excl", CSYNC_FTW_TYPE_DIR);
+    assert_int_equal(rc, CSYNC_FILE_EXCLUDE_LIST);
+
+    rc = csync_excluded(csync, "/excl", CSYNC_FTW_TYPE_FILE);
+    assert_int_equal(rc, CSYNC_NOT_EXCLUDED);
+}
 
 int torture_run_tests(void)
 {
@@ -148,6 +180,7 @@ int torture_run_tests(void)
         unit_test_setup_teardown(check_csync_exclude_add, setup, teardown),
         unit_test_setup_teardown(check_csync_exclude_load, setup, teardown),
         unit_test_setup_teardown(check_csync_excluded, setup_init, teardown),
+        unit_test_setup_teardown(check_csync_pathes, setup_init, teardown),
     };
 
     return run_tests(tests);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list