mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-03 13:20:13 +02:00
tests: FilenameIsMatching: tests for trailing pathdelims
git-svn-id: trunk@47716 -
This commit is contained in:
parent
a1a31b8f97
commit
ddfb215360
@ -1563,16 +1563,17 @@ function FilenameIsMatching(const Mask, Filename: string; MatchExactly: boolean
|
|||||||
just put the SpecialChar character in front of it (e.g. #*, #? #/).
|
just put the SpecialChar character in front of it (e.g. #*, #? #/).
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
/abc matches /abc, /abc/p, /abc/xyz/filename
|
/abc matches /abc, /abc/, /abc/p, /abc/xyz/filename
|
||||||
but not /abcd
|
but not /abcd
|
||||||
|
/abc/ matches /abc, /abc/, /abc//, but not /abc/.
|
||||||
/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
|
||||||
/abc/x*z/www matches /abc/xz/www, /abc/xyz/www, /abc/xAAAz/www
|
/abc/x*z/www matches /abc/xz/www, /abc/xyz/www, /abc/xAAAz/www
|
||||||
but not /abc/x/z/www
|
but not /abc/x/z/www
|
||||||
/abc/x#*z/www matches /abc/x*z/www, /abc/x*z/www/ttt
|
/abc/x#*z/www matches /abc/x*z/www, /abc/x*z/www/ttt
|
||||||
/a{b,c,d}e matches /abe, /ace, /ade
|
/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,} 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,},inc} matches a.pas, unit1.pp, b.p, b.inc but not c.lfm
|
||||||
*)
|
*)
|
||||||
{off $DEFINE VerboseFilenameIsMatching}
|
{off $DEFINE VerboseFilenameIsMatching}
|
||||||
|
|
||||||
|
@ -286,10 +286,12 @@ procedure TTestBasicCodeTools.TestFilenameIsMatching;
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
// /abc matches /abc, /abc/p, /abc/xyz/filename
|
// /abc matches /abc, /abc/, /abc/p, /abc/xyz/filename
|
||||||
// but not /abcd
|
// but not /abcd
|
||||||
t('/abc','/abc',true,true);
|
t('/abc','/abc',true,true);
|
||||||
t('/abc','/abc',false,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',true,false);
|
||||||
t('/abc','/abc/p',false,true);
|
t('/abc','/abc/p',false,true);
|
||||||
t('/abc','/abc/xyz/filename',false,true);
|
t('/abc','/abc/xyz/filename',false,true);
|
||||||
@ -297,6 +299,16 @@ begin
|
|||||||
t('/abc','/abcd',true,false);
|
t('/abc','/abcd',true,false);
|
||||||
t('/abc','/abcd',false,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
|
// /abc/x?z/www matches /abc/xyz/www, /abc/xaz/www
|
||||||
// but not /abc/x/z/www
|
// but not /abc/x/z/www
|
||||||
t('/abc/x?z/www','/abc/xyz/www',true,true);
|
t('/abc/x?z/www','/abc/xyz/www',true,true);
|
||||||
|
Loading…
Reference in New Issue
Block a user