codetools: FilenameIsMatching: fixed comparing mask with / at end and file has not

git-svn-id: trunk@47717 -
This commit is contained in:
mattias 2015-02-12 11:55:56 +00:00
parent ddfb215360
commit a573e115e0
3 changed files with 6 additions and 3 deletions

View File

@ -1624,6 +1624,8 @@ function FilenameIsMatching(const Mask, Filename: string; MatchExactly: boolean
// treat several PathDelim as one
while MaskP^=PathDelim do inc(MaskP);
while FileP^=PathDelim do inc(FileP);
if MaskP^=#0 then
exit((FileP^=#0) or not MatchExactly);
end;
'?':
begin

View File

@ -282,7 +282,7 @@ procedure TTestBasicCodeTools.TestFilenameIsMatching;
begin
Actual:=FilenameIsMatching(aMask,aFilename,aExactly);
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;
begin
@ -307,7 +307,9 @@ begin
t('/abc/','/abc//',true,true);
t('/abc/','/abc//',false,true);
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
// but not /abc/x/z/www

View File

@ -102,7 +102,6 @@
<Unit4>
<Filename Value="lcltests\testunicode.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="TestUnicode"/>
</Unit4>
<Unit5>
<Filename Value="testunits.pas"/>