runCapture function
Runs entryPoint under state, collecting every test(...) call made
during execution into CaptureState.captured. Returns that list.
Implementation
List<CapturedTest> runCapture(
CaptureState state,
void Function() entryPoint,
) {
final previous = _current;
_current = state;
try {
entryPoint();
} finally {
_current = previous;
}
return state.captured;
}