mirror of
https://github.com/lucaspalomodevelop/lpstd.git
synced 2026-03-12 23:27:22 +00:00
add testing exceptions
This commit is contained in:
parent
6fd7438ecc
commit
a62992c7dd
@ -178,5 +178,21 @@ namespace lpstd
|
||||
testSuite();
|
||||
}
|
||||
|
||||
void testThrow(std::function<void()> testCase)
|
||||
{
|
||||
try
|
||||
{
|
||||
testCase();
|
||||
}
|
||||
catch (std::exception &e)
|
||||
{
|
||||
std::cout << "✅ Expected exception thrown: " << e.what() << std::endl;
|
||||
Results.passed++;
|
||||
return;
|
||||
}
|
||||
std::cout << "❌ Expected exception not thrown" << std::endl;
|
||||
Results.failed++;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user