Runs the test and updates the test result.
| 3453 | |
| 3454 | // Runs the test and updates the test result. |
| 3455 | void Test::Run() { |
| 3456 | if (!HasSameFixtureClass()) return; |
| 3457 | |
| 3458 | internal::UnitTestImpl* const impl = internal::GetUnitTestImpl(); |
| 3459 | impl->os_stack_trace_getter()->UponLeavingGTest(); |
| 3460 | internal::HandleExceptionsInMethodIfSupported(this, &Test::SetUp, "SetUp()"); |
| 3461 | // We will run the test only if SetUp() was successful. |
| 3462 | if (!HasFatalFailure()) { |
| 3463 | impl->os_stack_trace_getter()->UponLeavingGTest(); |
| 3464 | internal::HandleExceptionsInMethodIfSupported( |
| 3465 | this, &Test::TestBody, "the test body"); |
| 3466 | } |
| 3467 | |
| 3468 | // However, we want to clean up as much as possible. Hence we will |
| 3469 | // always call TearDown(), even if SetUp() or the test body has |
| 3470 | // failed. |
| 3471 | impl->os_stack_trace_getter()->UponLeavingGTest(); |
| 3472 | internal::HandleExceptionsInMethodIfSupported( |
| 3473 | this, &Test::TearDown, "TearDown()"); |
| 3474 | } |
| 3475 | |
| 3476 | // Returns true iff the current test has a fatal failure. |
| 3477 | bool Test::HasFatalFailure() { |
no test coverage detected