diff options
author | Olivier Goffart <ogoffart@woboq.com> | 2017-12-15 15:00:50 +0300 |
---|---|---|
committer | Olivier Goffart <olivier@woboq.com> | 2017-12-15 21:16:20 +0300 |
commit | 1940c2f9bfb8458fb7f5f822bf40561a082b3b3a (patch) | |
tree | ec571ea17f5920c6239a0ed53722035f33618048 /test | |
parent | 83e94c3ec72b0f9c097f825d58875a5df282874a (diff) |
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
Diffstat (limited to 'test')
-rw-r--r-- | test/csync/csync_tests/check_csync_exclude.cpp | 24 | ||||
-rw-r--r-- | test/testexcludedfiles.cpp | 2 |
2 files changed, 12 insertions, 14 deletions
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 { |