mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-12 23:24:41 +00:00
Allow test runs to be non-verbose.
This commit is contained in:
parent
b01e5668b4
commit
d02cc94edd
1 changed files with 14 additions and 7 deletions
|
|
@ -36,8 +36,9 @@ class TorqueUnitTestListener : public ::testing::EmptyTestEventListener
|
||||||
// Called before a test starts.
|
// Called before a test starts.
|
||||||
virtual void OnTestStart( const ::testing::TestInfo& testInfo )
|
virtual void OnTestStart( const ::testing::TestInfo& testInfo )
|
||||||
{
|
{
|
||||||
Con::printf("> Starting Test '%s.%s'",
|
if( mVerbose )
|
||||||
testInfo.test_case_name(), testInfo.name());
|
Con::printf("> Starting Test '%s.%s'",
|
||||||
|
testInfo.test_case_name(), testInfo.name());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called after a failed assertion or a SUCCEED() invocation.
|
// Called after a failed assertion or a SUCCEED() invocation.
|
||||||
|
|
@ -45,13 +46,13 @@ class TorqueUnitTestListener : public ::testing::EmptyTestEventListener
|
||||||
{
|
{
|
||||||
if ( testPartResult.failed() )
|
if ( testPartResult.failed() )
|
||||||
{
|
{
|
||||||
Con::warnf(">> Failed with '%s' in '%s' at (line:%d)",
|
Con::warnf(">> Failed with '%s' in '%s' at (line:%d)\n",
|
||||||
testPartResult.summary(),
|
testPartResult.summary(),
|
||||||
testPartResult.file_name(),
|
testPartResult.file_name(),
|
||||||
testPartResult.line_number()
|
testPartResult.line_number()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else if( mVerbose )
|
||||||
{
|
{
|
||||||
Con::printf(">> Passed with '%s' in '%s' at (line:%d)",
|
Con::printf(">> Passed with '%s' in '%s' at (line:%d)",
|
||||||
testPartResult.summary(),
|
testPartResult.summary(),
|
||||||
|
|
@ -64,9 +65,15 @@ class TorqueUnitTestListener : public ::testing::EmptyTestEventListener
|
||||||
// Called after a test ends.
|
// Called after a test ends.
|
||||||
virtual void OnTestEnd( const ::testing::TestInfo& testInfo )
|
virtual void OnTestEnd( const ::testing::TestInfo& testInfo )
|
||||||
{
|
{
|
||||||
Con::printf("> Ending Test '%s.%s'\n",
|
if( mVerbose )
|
||||||
testInfo.test_case_name(), testInfo.name());
|
Con::printf("> Ending Test '%s.%s'\n",
|
||||||
|
testInfo.test_case_name(), testInfo.name());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool mVerbose;
|
||||||
|
|
||||||
|
public:
|
||||||
|
TorqueUnitTestListener( bool verbose ) : mVerbose( verbose ) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
DefineConsoleFunction( runAllUnitTests, int, (const char* testSpecs), (""),
|
DefineConsoleFunction( runAllUnitTests, int, (const char* testSpecs), (""),
|
||||||
|
|
@ -113,7 +120,7 @@ DefineConsoleFunction( runAllUnitTests, int, (const char* testSpecs), (""),
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the Torque unit test listener.
|
// Add the Torque unit test listener.
|
||||||
listeners.Append( new TorqueUnitTestListener );
|
listeners.Append( new TorqueUnitTestListener(false) );
|
||||||
|
|
||||||
// Perform googletest run.
|
// Perform googletest run.
|
||||||
Con::printf( "\nUnit Tests Starting...\n" );
|
Con::printf( "\nUnit Tests Starting...\n" );
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue