aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/test_modes_filter_all.c12
-rw-r--r--tests/test_modes_filter_general.c12
2 files changed, 24 insertions, 0 deletions
diff --git a/tests/test_modes_filter_all.c b/tests/test_modes_filter_all.c
index 4f41dce..7e19242 100644
--- a/tests/test_modes_filter_all.c
+++ b/tests/test_modes_filter_all.c
@@ -6,16 +6,26 @@
#define MAX_PART CLEANPATH_PART_MAX
#define MAX_RECORD 255
+#if OS_WINDOWS
+// Disable regex filter test
+#undef MAX_MODE
+#define MAX_MODE 2
+#endif
+
unsigned modes[MAX_MODE] = {
CLEANPATH_FILTER_EXACT,
CLEANPATH_FILTER_LOOSE,
+#if !OS_WINDOWS
CLEANPATH_FILTER_REGEX,
+#endif
};
char *modes_str[MAX_MODE] = {
"exact",
"loose",
+#if !OS_WINDOWS
"regex",
+#endif
};
const char *inputs[MAX_MODE][MAX_PART][MAX_RECORD] = {
@@ -35,10 +45,12 @@ const char *inputs[MAX_MODE][MAX_PART][MAX_RECORD] = {
"bin",
NULL
},
+#if !OS_WINDOWS
{ // Filter regex
".*",
NULL
},
+#endif
};
struct TestResult {
diff --git a/tests/test_modes_filter_general.c b/tests/test_modes_filter_general.c
index e3a9cda..50dec68 100644
--- a/tests/test_modes_filter_general.c
+++ b/tests/test_modes_filter_general.c
@@ -5,16 +5,26 @@
#define MAX_PART CLEANPATH_PART_MAX
#define MAX_RECORD 255
+#if OS_WINDOWS
+// Disable regex filter test
+#undef MAX_MODE
+#define MAX_MODE 2
+#endif
+
unsigned modes[MAX_MODE] = {
CLEANPATH_FILTER_EXACT,
CLEANPATH_FILTER_LOOSE,
+#if !OS_WINDOWS
CLEANPATH_FILTER_REGEX,
+#endif
};
char *modes_str[MAX_MODE] = {
"exact",
"loose",
+#if !OS_WINDOWS
"regex",
+#endif
};
const char *inputs[MAX_MODE][MAX_PART][MAX_RECORD] = {
@@ -29,12 +39,14 @@ const char *inputs[MAX_MODE][MAX_PART][MAX_RECORD] = {
"intentionally bad", // test non-existent pattern in string
NULL
},
+#if !OS_WINDOWS
{ // Filter regex
"^/opt/local/.*",
"intentionally bad", // test non-existent pattern in string
"intentionally worse (", // cause total regex failure with unmatched parenthesis
NULL
},
+#endif
};
const char *expected = "/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/Apple/usr/bin";