From ddfb21536069a22c2974c981271438650f0d5b5a Mon Sep 17 00:00:00 2001 From: mattias Date: Thu, 12 Feb 2015 11:42:19 +0000 Subject: [PATCH] tests: FilenameIsMatching: tests for trailing pathdelims git-svn-id: trunk@47716 - --- components/codetools/fileprocs.pas | 7 ++++--- test/codetoolstests/testbasiccodetools.pas | 14 +++++++++++++- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/components/codetools/fileprocs.pas b/components/codetools/fileprocs.pas index 33ec006de4..769c5f4960 100644 --- a/components/codetools/fileprocs.pas +++ b/components/codetools/fileprocs.pas @@ -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} diff --git a/test/codetoolstests/testbasiccodetools.pas b/test/codetoolstests/testbasiccodetools.pas index 2bf4187abb..1dccb427ea 100644 --- a/test/codetoolstests/testbasiccodetools.pas +++ b/test/codetoolstests/testbasiccodetools.pas @@ -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);