Add default to UnitTest::fail() and tidy up

This commit is contained in:
Vinnie Falco
2013-08-02 08:35:39 -07:00
parent b7e3de987f
commit 87fe9ed877
2 changed files with 3 additions and 5 deletions

View File

@@ -135,9 +135,7 @@ void UnitTest::pass ()
// If this goes off it means you forgot to call beginTestCase()! // If this goes off it means you forgot to call beginTestCase()!
bassert (m_case != nullptr); bassert (m_case != nullptr);
Item item (true); m_case->items.add (Item (true));
m_case->items.add (item);
} }
void UnitTest::fail (String const& failureMessage) void UnitTest::fail (String const& failureMessage)
@@ -148,7 +146,7 @@ void UnitTest::fail (String const& failureMessage)
Item item (false, failureMessage); Item item (false, failureMessage);
m_case->failures++; m_case->failures++;
int const caseNumber = m_case->items.add (item); int const caseNumber = m_case->items.add (Item (false, failureMessage));
String s; String s;
s << "#" << String (caseNumber) << " failed: " << failureMessage; s << "#" << String (caseNumber) << " failed: " << failureMessage;

View File

@@ -295,7 +295,7 @@ public:
void pass (); void pass ();
/** Causes the test item to fail. */ /** Causes the test item to fail. */
void fail (String const& failureMessage); void fail (String const& failureMessage = String::empty);
/** Records an exception in the test item. */ /** Records an exception in the test item. */
void failException (); void failException ();