added a test for dir_reader::matches
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@3817 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
fb60920df7
commit
eb24f3cb99
2 changed files with 57 additions and 0 deletions
|
@ -92,6 +92,10 @@ LINK32=link.exe
|
|||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\dirreader.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\growbuf.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
@ -120,6 +124,10 @@ SOURCE=.\mmap.cpp
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\specmatch.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\textrunner.cpp
|
||||
# End Source File
|
||||
# End Group
|
||||
|
@ -128,6 +136,10 @@ SOURCE=.\textrunner.cpp
|
|||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\dirreader.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\mmap.h
|
||||
# End Source File
|
||||
# End Group
|
||||
|
|
45
Source/Tests/specmatch.cpp
Normal file
45
Source/Tests/specmatch.cpp
Normal file
|
@ -0,0 +1,45 @@
|
|||
#include <cppunit/extensions/HelperMacros.h>
|
||||
#include "../dirreader.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
using namespace std;
|
||||
|
||||
class SpecTest : public CppUnit::TestFixture {
|
||||
|
||||
CPPUNIT_TEST_SUITE( SpecTest );
|
||||
CPPUNIT_TEST( testMatches );
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
|
||||
public:
|
||||
void testMatches() {
|
||||
testMatch("test.exe", "test.exe", true);
|
||||
testMatch("test", "test", true);
|
||||
testMatch("test.exe", "test.*", true);
|
||||
testMatch("test", "test.*", true);
|
||||
testMatch("test", "????", true);
|
||||
testMatch("test", "???", false);
|
||||
testMatch("test", "*.exe", false);
|
||||
testMatch("test.exe.bat", "*.exe", false);
|
||||
testMatch("test.exe.bat", "*.bat", true);
|
||||
testMatch("test.exe.bat", "*t", true);
|
||||
testMatch("test.exe.bat", "*", true);
|
||||
testMatch("test.exe.bat", "*x*", true);
|
||||
testMatch("test.exe.exe", "*.*", true);
|
||||
testMatch("test.exe.bat", "*.b*", true);
|
||||
testMatch("test.exe.bat", "tes?.*.bat", true);
|
||||
testMatch("test.exe.bat", "tes?.*bat", true);
|
||||
testMatch("test.exe.bat", "tes?.*bat***.", true);
|
||||
testMatch("test.exe", "????.*", true);
|
||||
testMatch("testing.exe", "????.*", false);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
void testMatch(string name, string spec, bool result) {
|
||||
CPPUNIT_ASSERT_EQUAL( dir_reader::matches(name, spec), result );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
CPPUNIT_TEST_SUITE_REGISTRATION( SpecTest );
|
Loading…
Add table
Add a link
Reference in a new issue