LazUtils: Test: TestMasks: adjust Windows tests after the the removal of wqFileNameEnd from DefaultWindowsQuirks.

This commit is contained in:
Bart 2021-11-10 22:15:14 +01:00
parent eb63676746
commit 1643927f8f

View File

@ -37,6 +37,7 @@ type
procedure TestMaskDisableRange(const S, Mask: String; Result: Boolean);
procedure TestMaskAdvanced(const S, Mask: String; Result: Boolean);
procedure TestMaskWindows(const S, Mask: String; Result: Boolean);
procedure TestMaskWindowsNonDefaultQuirks(const S, Mask: String; Result: Boolean);
procedure TestMaskException(const S, Mask: String; AFail: Boolean);
published
procedure TestMaskSyntax;
@ -78,6 +79,12 @@ begin
AssertEquals(S + ' match ' + Mask + ': ', Result, MatchesWindowsMask(S, Mask));
end;
procedure TTestMask.TestMaskWindowsNonDefaultQuirks(const S, Mask: String;
Result: Boolean);
begin
AssertEquals(S + ' match ' + Mask + ': ', Result, MatchesWindowsMask(S, Mask, False, DefaultMaskOpCodes, [wqFilenameEnd,wqExtension3More,wqAllByExtension]));
end;
procedure TTestMask.TestMaskException(const S, Mask: String; AFail: Boolean);
begin
FS := S;
@ -309,15 +316,17 @@ begin
TestMaskWindows('abc.txt', '*', True);
TestMaskWindows('abc', '*', True);
TestMaskWindows('abc', '*.', True);
TestMaskWindows('abcd.txt', 'abc???.*', True);
TestMaskWindows('abcd.txt', 'abc???.txt?', True);
TestMaskWindows('abcd.txt', 'abc???.*', False);
TestMaskWindows('abcd.txt', 'abc???.txt?', False);
TestMaskWindowsNonDefaultQuirks('abcd.txt', 'abc???.*', True);
TestMaskWindowsNonDefaultQuirks('abcd.txt', 'abc???.txt?', True);
TestMaskWindows('abcd.txt', 'abc*', True);
TestMaskWindows('abc.pas.bak', '*.bak', True);
TestMaskWindows('C:\x', 'C:\x', True);
TestMaskWindows('C:\ab[c]d', 'C:*[*]*', False); //sets and ranges are enabled by default on TWindowsMaks as well
TestMaskWindows('C:\ab[c]d', 'C:*[*]*', False); //sets and ranges are enabled by default on TWindowsMask as well
TestMaskWindows('', '*', True);
TestMaskWindows('', '?', True);
TestMaskWindows('', '?', False);
TestMaskWindowsNonDefaultQuirks('', '?', True); //requires wqFileNameEnd
TestMaskWindows('abcd.txt', '*.txtx', False);
TestMaskWindows('abc.txt', '*.', False);
TestMaskWindows('abc.txt', '.*', False);