From 1940c2f9bfb8458fb7f5f822bf40561a082b3b3a Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Fri, 15 Dec 2017 13:00:50 +0100 Subject: Exclude: Use Qt to load the exclude file fopen does not work well with relative path tand forward slashes on windows This fix the windows textexcludedfiles test. And also make the code simpler. Note that the 'trimmed' might be a behavior change, but i think it is ok --- test/csync/csync_tests/check_csync_exclude.cpp | 24 +++++++++++------------- test/testexcludedfiles.cpp | 2 +- 2 files changed, 12 insertions(+), 14 deletions(-) (limited to 'test') diff --git a/test/csync/csync_tests/check_csync_exclude.cpp b/test/csync/csync_tests/check_csync_exclude.cpp index 7c64ce5de..0062c2a39 100644 --- a/test/csync/csync_tests/check_csync_exclude.cpp +++ b/test/csync/csync_tests/check_csync_exclude.cpp @@ -512,19 +512,17 @@ static void check_csync_exclude_expand_escapes(void **state) { (void)state; - const char *str = csync_exclude_expand_escapes( - "keep \\' \\\" \\? \\\\ \\a \\b \\f \\n \\r \\t \\v \\z \\#"); - assert_true(0 == strcmp( - str, "keep ' \" ? \\\\ \a \b \f \n \r \t \v \\z #")); - SAFE_FREE(str); - - str = csync_exclude_expand_escapes(""); - assert_true(0 == strcmp(str, "")); - SAFE_FREE(str); - - str = csync_exclude_expand_escapes("\\"); - assert_true(0 == strcmp(str, "\\")); - SAFE_FREE(str); + QByteArray line = "keep \\' \\\" \\? \\\\ \\a \\b \\f \\n \\r \\t \\v \\z \\#"; + csync_exclude_expand_escapes(line); + assert_true(0 == strcmp(line.constData(), "keep ' \" ? \\\\ \a \b \f \n \r \t \v \\z #")); + + line = ""; + csync_exclude_expand_escapes(line); + assert_true(0 == strcmp(line.constData(), "")); + + line = "\\"; + csync_exclude_expand_escapes(line); + assert_true(0 == strcmp(line.constData(), "\\")); } }; // class ExcludedFilesTest diff --git a/test/testexcludedfiles.cpp b/test/testexcludedfiles.cpp index b743ffd81..5043768ec 100644 --- a/test/testexcludedfiles.cpp +++ b/test/testexcludedfiles.cpp @@ -11,7 +11,7 @@ using namespace OCC; -#define EXCLUDE_LIST_FILE SOURCEDIR"/../../sync-exclude.lst" +#define EXCLUDE_LIST_FILE SOURCEDIR "/../../sync-exclude.lst" class TestExcludedFiles: public QObject { -- cgit v1.2.3