ExceptionCollector

Usage

ExceptionCollector is a utility that allows you to have multiple exceptions thrown, without stopping the execution of the program, and then throw them all later.

ApprovalTests::ExceptionCollector exceptions;

for (int i = 1; i <= 4; ++i)
{
    exceptions.gather([&]() { /* Code that may throw errors here */ });
}
exceptions.release(); // All errors actually thrown together here

(See snippet source)

Use with Approval Tests: See Approving multiple files in one test.