aboutsummaryrefslogtreecommitdiff
path: root/src/stable/unitsuite.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2012-04-14 18:04:52 +0000
committerMike Buland <eichlan@xagasoft.com>2012-04-14 18:04:52 +0000
commitda1de5cdb5c42ce811a66d377789e585042b98c7 (patch)
tree44f530399c603252535232ae6483abce734ca828 /src/stable/unitsuite.cpp
parent49d9fa3c2435b8e97ffdc42e40a880a3dad82f8a (diff)
downloadlibbu++-da1de5cdb5c42ce811a66d377789e585042b98c7.tar.gz
libbu++-da1de5cdb5c42ce811a66d377789e585042b98c7.tar.bz2
libbu++-da1de5cdb5c42ce811a66d377789e585042b98c7.tar.xz
libbu++-da1de5cdb5c42ce811a66d377789e585042b98c7.zip
Added support for running subsets of unit tests to Bu::UnitSuite, now just list
the names of the tests you want to run on the command line. Also, fixed some minor issues in two of the test suites.
Diffstat (limited to 'src/stable/unitsuite.cpp')
-rw-r--r--src/stable/unitsuite.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/stable/unitsuite.cpp b/src/stable/unitsuite.cpp
index db930a4..e508c6f 100644
--- a/src/stable/unitsuite.cpp
+++ b/src/stable/unitsuite.cpp
@@ -32,7 +32,6 @@ Bu::UnitSuite::~UnitSuite()
32{ 32{
33} 33}
34 34
35// Argument handling is coming soon, I promise.
36int Bu::UnitSuite::run( int argc, char *argv[] ) 35int Bu::UnitSuite::run( int argc, char *argv[] )
37{ 36{
38 bool bCleanup = true; 37 bool bCleanup = true;
@@ -41,9 +40,22 @@ int Bu::UnitSuite::run( int argc, char *argv[] )
41 "List available test cases." ); 40 "List available test cases." );
42 p.addOption( bCleanup, "no-cleanup", "Don't erase temp files."); 41 p.addOption( bCleanup, "no-cleanup", "Don't erase temp files.");
43 p.setOverride( "no-cleanup", false ); 42 p.setOverride( "no-cleanup", false );
43 p.setNonOption( Bu::slot( this, &Bu::UnitSuite::onAddTest ) );
44 p.addHelpOption(); 44 p.addHelpOption();
45 p.parse( argc, argv ); 45 p.parse( argc, argv );
46 46
47 if( !hSelTests.isEmpty() )
48 {
49 TestList lSub;
50 for( TestList::iterator i = lTests.begin(); i != lTests.end(); i++ )
51 {
52 if( hSelTests.has( (*i).sName ) )
53 lSub.append( *i );
54 }
55
56 lTests = lSub;
57 }
58
47 int iEPass = 0; 59 int iEPass = 0;
48 int iEFail = 0; 60 int iEFail = 0;
49 int iUPass = 0; 61 int iUPass = 0;
@@ -239,6 +251,12 @@ int Bu::UnitSuite::onListCases( StrArray )
239 return 0; 251 return 0;
240} 252}
241 253
254int Bu::UnitSuite::onAddTest( StrArray aParam )
255{
256 hSelTests.insert( aParam[0], true );
257 return 0;
258}
259
242Bu::Formatter &Bu::operator<<( Bu::Formatter &f, const Bu::UnitSuite::Expect &e ) 260Bu::Formatter &Bu::operator<<( Bu::Formatter &f, const Bu::UnitSuite::Expect &e )
243{ 261{
244 switch( e ) 262 switch( e )