Skip to content

Commit 91061c4

Browse files
avargitster
authored andcommitted
wildmatch test: perform all tests under all wildmatch() modes
Rewrite the wildmatch() test suite so that each test now tests all combinations of the wildmatch() WM_CASEFOLD and WM_PATHNAME flags. Before this change some test inputs were not tested on e.g. WM_PATHNAME. Now the function is stress tested on all possible inputs, and for each input we declare what the result should be if the mode is case-insensitive, or pathname matching, or case-sensitive or not matching pathnames. Also before this change, nothing was testing case-insensitive non-pathname matching, so I've added that to test-wildmatch.c and made use of it. This yields a rather scary patch, but there are no functional changes here, just more test coverage. Some now-redundant tests were deleted as a result of this change, since they were now duplicating an earlier test. Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 4bc280f commit 91061c4

File tree

2 files changed

+228
-252
lines changed

2 files changed

+228
-252
lines changed

t/helper/test-wildmatch.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ int cmd_main(int argc, const char **argv)
1616
return !!wildmatch(argv[3], argv[2], WM_PATHNAME | WM_CASEFOLD);
1717
else if (!strcmp(argv[1], "pathmatch"))
1818
return !!wildmatch(argv[3], argv[2], 0);
19+
else if (!strcmp(argv[1], "ipathmatch"))
20+
return !!wildmatch(argv[3], argv[2], WM_CASEFOLD);
1921
else
2022
return 1;
2123
}

0 commit comments

Comments
 (0)