diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/CMakeLists.txt | 2 | ||||
-rw-r--r-- | tests/test_errors.c | 6 | ||||
-rw-r--r-- | tests/test_modes_filter_all.c | 12 | ||||
-rw-r--r-- | tests/test_modes_filter_general.c | 12 |
4 files changed, 17 insertions, 15 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 7a56301..7a7d3db 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -27,7 +27,7 @@ endforeach() # processes. set(TEST_SETUP -E TESTVAR) -if(${CMAKE_SYSTEM_NAME} EQUAL WINDOWS) +if(WIN32) set(TEST_SETUP ${TEST_SETUP}_WIN) set(exec ${CMAKE_BINARY_DIR}/cleanpath.exe) diff --git a/tests/test_errors.c b/tests/test_errors.c index 82241ed..18c444e 100644 --- a/tests/test_errors.c +++ b/tests/test_errors.c @@ -6,6 +6,8 @@ int main() { path = NULL; //intentionally bad - myassert(cleanpath_init("good", NULL) == NULL, "cleanpath_init() returned non-NULL on NULL sep\n"); - myassert(cleanpath_init(NULL, "good") == NULL, "cleanpath_init() returned non-NULL on NULL path\n"); + myassert((path = cleanpath_init("good", NULL)) == NULL, "cleanpath_init() returned non-NULL on NULL sep\n"); + if (path) cleanpath_free(path); + myassert((path = cleanpath_init(NULL, "good")) == NULL, "cleanpath_init() returned non-NULL on NULL path\n"); + if (path) cleanpath_free(path); } diff --git a/tests/test_modes_filter_all.c b/tests/test_modes_filter_all.c index d57b418..3893be0 100644 --- a/tests/test_modes_filter_all.c +++ b/tests/test_modes_filter_all.c @@ -30,7 +30,7 @@ char *modes_str[MAX_MODE] = { const char *inputs[MAX_MODE][MAX_PART][MAX_RECORD] = { { // Filter exact - "/opt/local/bin", + {"/opt/local/bin", "/opt/local/sbin", "/usr/local/bin", "/usr/bin", @@ -39,16 +39,16 @@ const char *inputs[MAX_MODE][MAX_PART][MAX_RECORD] = { "/sbin", "/opt/X11/bin", "/Library/Apple/usr/bin", - NULL + NULL} }, { // Filter loose - "bin", - NULL + {"bin", + NULL} }, #if !OS_WINDOWS { // Filter regex - ".*", - NULL + {".*", + NULL} }, #endif }; diff --git a/tests/test_modes_filter_general.c b/tests/test_modes_filter_general.c index 45206a4..d33ebb9 100644 --- a/tests/test_modes_filter_general.c +++ b/tests/test_modes_filter_general.c @@ -29,22 +29,22 @@ char *modes_str[MAX_MODE] = { const char *inputs[MAX_MODE][MAX_PART][MAX_RECORD] = { { // Filter exact - "/opt/local/bin", + {"/opt/local/bin", "/opt/local/sbin", "intentionally bad", // test non-existent pattern in string - NULL + NULL} }, { // Filter loose - "/opt/local", + {"/opt/local", "intentionally bad", // test non-existent pattern in string - NULL + NULL} }, #if !OS_WINDOWS { // Filter regex - "^/opt/local/.*", + {"^/opt/local/.*", "intentionally bad", // test non-existent pattern in string "intentionally worse (", // cause total regex failure with unmatched parenthesis - NULL + NULL} }, #endif }; |