tests: FilenameIsMatching: tests for trailing pathdelims

git-svn-id: trunk@47716 -
This commit is contained in:
mattias 2015-02-12 11:42:19 +00:00
parent a1a31b8f97
commit ddfb215360
2 changed files with 17 additions and 4 deletions

View File

@ -1563,16 +1563,17 @@ function FilenameIsMatching(const Mask, Filename: string; MatchExactly: boolean
just put the SpecialChar character in front of it (e.g. #*, #? #/).
Examples:
/abc matches /abc, /abc/p, /abc/xyz/filename
/abc matches /abc, /abc/, /abc/p, /abc/xyz/filename
but not /abcd
/abc/ matches /abc, /abc/, /abc//, but not /abc/.
/abc/x?z/www matches /abc/xyz/www, /abc/xaz/www
but not /abc/x/z/www
/abc/x*z/www matches /abc/xz/www, /abc/xyz/www, /abc/xAAAz/www
but not /abc/x/z/www
/abc/x#*z/www matches /abc/x*z/www, /abc/x*z/www/ttt
/a{b,c,d}e matches /abe, /ace, /ade
*.p{as,p,} matches a.pas unit1.pp b.p but not b.inc
*.{p{as,p,},inc} matches a.pas unit1.pp b.p b.inc but not c.lfm
*.p{as,p,} matches a.pas, unit1.pp, b.p but not b.inc
*.{p{as,p,},inc} matches a.pas, unit1.pp, b.p, b.inc but not c.lfm
*)
{off $DEFINE VerboseFilenameIsMatching}

View File

@ -286,10 +286,12 @@ procedure TTestBasicCodeTools.TestFilenameIsMatching;
end;
begin
// /abc matches /abc, /abc/p, /abc/xyz/filename
// /abc matches /abc, /abc/, /abc/p, /abc/xyz/filename
// but not /abcd
t('/abc','/abc',true,true);
t('/abc','/abc',false,true);
t('/abc','/abc/',true,true);
t('/abc','/abc/',false,true);
t('/abc','/abc/p',true,false);
t('/abc','/abc/p',false,true);
t('/abc','/abc/xyz/filename',false,true);
@ -297,6 +299,16 @@ begin
t('/abc','/abcd',true,false);
t('/abc','/abcd',false,false);
// /abc/ matches /abc, /abc/, /abc//, but not /abc/.
t('/abc/','/abc',true,true);
t('/abc/','/abc',false,true);
t('/abc/','/abc/',true,true);
t('/abc/','/abc/',false,true);
t('/abc/','/abc//',true,true);
t('/abc/','/abc//',false,true);
t('/abc/','/abc/.',true,false);
t('/abc/','/abc/.',false,false);
// /abc/x?z/www matches /abc/xyz/www, /abc/xaz/www
// but not /abc/x/z/www
t('/abc/x?z/www','/abc/xyz/www',true,true);