aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2024-02-09 15:24:38 +0100
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2024-02-09 15:32:41 +0100
commit48b3355c7a887530a9bd17a1ad571e402102dd95 (patch)
treed4f47abc466f9662b677e130dc6ae847dce5ee9a /tests
parentf47425873fad94d3e7add4c7d5c48c2f7c67dbe5 (diff)
Remove check for OS specific stuff from is_filename_sane
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'tests')
-rw-r--r--tests/libutil/Makemodule.am7
-rw-r--r--tests/libutil/filename_sane.c51
2 files changed, 3 insertions, 55 deletions
diff --git a/tests/libutil/Makemodule.am b/tests/libutil/Makemodule.am
index c84f722..e039282 100644
--- a/tests/libutil/Makemodule.am
+++ b/tests/libutil/Makemodule.am
@@ -27,11 +27,6 @@ test_filename_sane_SOURCES = tests/libutil/filename_sane.c
test_filename_sane_SOURCES += lib/util/filename_sane.c
test_filename_sane_LDADD = libcompat.a libutil.a
-test_filename_sane_w32_SOURCES = tests/libutil/filename_sane.c
-test_filename_sane_w32_SOURCES += lib/util/filename_sane.c
-test_filename_sane_w32_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_WIN32=1
-test_filename_sane_w32_LDADD = libcompat.a
-
test_sdate_epoch_SOURCES = tests/libutil/epoch.c
test_sdate_epoch_LDADD = libutil.a libcompat.a
@@ -43,7 +38,7 @@ test_base64_decode_LDADD = libutil.a libcompat.a
LIBUTIL_TESTS = \
test_str_table test_rbtree test_xxhash test_threadpool test_ismemzero \
- test_canonicalize_name test_filename_sane test_filename_sane_w32 \
+ test_canonicalize_name test_filename_sane \
test_sdate_epoch test_hex_decode test_base64_decode
check_PROGRAMS += $(LIBUTIL_TESTS)
diff --git a/tests/libutil/filename_sane.c b/tests/libutil/filename_sane.c
index 9c9930d..1a2cf72 100644
--- a/tests/libutil/filename_sane.c
+++ b/tests/libutil/filename_sane.c
@@ -11,9 +11,6 @@
static const char *must_work[] = {
"foobar",
"test.txt",
-#if !defined(_WIN32) && !defined(__WINDOWS__) && !defined(TEST_WIN32)
- "\\foo", "foo\\", "foo\\bar",
-#endif
NULL,
};
@@ -26,68 +23,24 @@ static const char *must_not_work[] = {
NULL,
};
-static const char *must_not_work_here[] = {
-#if defined(_WIN32) || defined(__WINDOWS__) || defined(TEST_WIN32)
- "\\foo", "foo\\", "foo\\bar",
- "fo<o", "fo>o", "fo:o", "fo\"o",
- "fo|o", "fo?o", "fo*o", "fo\ro",
- "CON", "PRN", "AUX", "NUL",
- "COM1", "COM2", "LPT1", "LPT2",
- "con", "prn", "aux", "nul",
- "com1", "com2", "lpt1", "lpt2",
- "AUX.txt", "aux.txt", "NUL.txt", "nul.txt",
-#endif
- NULL,
-};
-
int main(int argc, char **argv)
{
size_t i;
(void)argc; (void)argv;
for (i = 0; must_work[i] != NULL; ++i) {
- if (!is_filename_sane(must_work[i], false)) {
+ if (!is_filename_sane(must_work[i])) {
fprintf(stderr, "%s was rejected!\n", must_work[i]);
return EXIT_FAILURE;
}
-
- if (!is_filename_sane(must_work[i], true)) {
- fprintf(stderr,
- "%s was rejected when testing for "
- "OS specific stuff!\n", must_work[i]);
- return EXIT_FAILURE;
- }
}
for (i = 0; must_not_work[i] != NULL; ++i) {
- if (is_filename_sane(must_not_work[i], false)) {
+ if (is_filename_sane(must_not_work[i])) {
fprintf(stderr, "%s was accepted!\n",
must_not_work[i]);
return EXIT_FAILURE;
}
-
- if (is_filename_sane(must_not_work[i], true)) {
- fprintf(stderr,
- "%s was accepted when testing for "
- "OS specific stuff!\n", must_not_work[i]);
- return EXIT_FAILURE;
- }
- }
-
- for (i = 0; must_not_work_here[i] != NULL; ++i) {
- if (!is_filename_sane(must_not_work_here[i], false)) {
- fprintf(stderr,
- "%s was rejected in the generic test!\n",
- must_not_work_here[i]);
- return EXIT_FAILURE;
- }
-
- if (is_filename_sane(must_not_work_here[i], true)) {
- fprintf(stderr,
- "%s was accepted when testing for "
- "OS specific stuff!\n", must_not_work_here[i]);
- return EXIT_FAILURE;
- }
}
return EXIT_SUCCESS;