mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-20 01:48:18 +02:00
codetools: FilenameIsMatching: fixed comparing mask with / at end and file has not
git-svn-id: trunk@47717 -
This commit is contained in:
parent
ddfb215360
commit
a573e115e0
@ -1624,6 +1624,8 @@ function FilenameIsMatching(const Mask, Filename: string; MatchExactly: boolean
|
|||||||
// treat several PathDelim as one
|
// treat several PathDelim as one
|
||||||
while MaskP^=PathDelim do inc(MaskP);
|
while MaskP^=PathDelim do inc(MaskP);
|
||||||
while FileP^=PathDelim do inc(FileP);
|
while FileP^=PathDelim do inc(FileP);
|
||||||
|
if MaskP^=#0 then
|
||||||
|
exit((FileP^=#0) or not MatchExactly);
|
||||||
end;
|
end;
|
||||||
'?':
|
'?':
|
||||||
begin
|
begin
|
||||||
|
@ -282,7 +282,7 @@ procedure TTestBasicCodeTools.TestFilenameIsMatching;
|
|||||||
begin
|
begin
|
||||||
Actual:=FilenameIsMatching(aMask,aFilename,aExactly);
|
Actual:=FilenameIsMatching(aMask,aFilename,aExactly);
|
||||||
if Actual=Expected then exit;
|
if Actual=Expected then exit;
|
||||||
AssertEquals('FilenameIsMatching failed: Mask="'+aMask+'" File="'+aFilename+'" Exactly='+dbgs(aExactly),Expected,Actual);
|
AssertEquals('Mask="'+aMask+'" File="'+aFilename+'" Exactly='+dbgs(aExactly),Expected,Actual);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
@ -307,7 +307,9 @@ begin
|
|||||||
t('/abc/','/abc//',true,true);
|
t('/abc/','/abc//',true,true);
|
||||||
t('/abc/','/abc//',false,true);
|
t('/abc/','/abc//',false,true);
|
||||||
t('/abc/','/abc/.',true,false);
|
t('/abc/','/abc/.',true,false);
|
||||||
t('/abc/','/abc/.',false,false);
|
t('/abc/','/abc/.',false,true);
|
||||||
|
t('/abc/','/abc/d',true,false);
|
||||||
|
t('/abc/','/abc/d',false,true);
|
||||||
|
|
||||||
// /abc/x?z/www matches /abc/xyz/www, /abc/xaz/www
|
// /abc/x?z/www matches /abc/xyz/www, /abc/xaz/www
|
||||||
// but not /abc/x/z/www
|
// but not /abc/x/z/www
|
||||||
|
@ -102,7 +102,6 @@
|
|||||||
<Unit4>
|
<Unit4>
|
||||||
<Filename Value="lcltests\testunicode.pas"/>
|
<Filename Value="lcltests\testunicode.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="TestUnicode"/>
|
|
||||||
</Unit4>
|
</Unit4>
|
||||||
<Unit5>
|
<Unit5>
|
||||||
<Filename Value="testunits.pas"/>
|
<Filename Value="testunits.pas"/>
|
||||||
|
Loading…
Reference in New Issue
Block a user