class DeathTest
Defined at line 99 of file ../../third_party/googletest/src/googletest/include/gtest/internal/gtest-death-test-internal.h
In describing the results of death tests, these terms are used with
the corresponding definitions:
exit status: The integer exit information in the format specified
by wait(2)
exit code: The integer code passed to exit(3), _Exit(2), or
returned from main()
Public Methods
bool Create (const char * statement, Matcher<const std::string &> matcher, const char * file, int line, DeathTest ** test)
Create returns false if there was an error determining the
appropriate action to take for the current death test; for example,
if the gtest_death_test_style flag is set to an invalid value.
The LastMessage method will return a more detailed message in that
case. Otherwise, the DeathTest pointer pointed to by the "test"
argument is set. If the death test should be skipped, the pointer
is set to NULL; otherwise, it is set to the address of a new concrete
DeathTest object that controls the execution of the current test.
void DeathTest ()
TestRole AssumeRole ()
Assumes one of the above roles.
int Wait ()
Waits for the death test to finish and returns its status.
bool Passed (bool exit_status_ok)
Returns true if the death test passed; that is, the test process
exited during the test, its exit status matches a user-supplied
predicate, and its stderr output matches a user-supplied regular
expression.
The user-supplied predicate may be a macro expression rather
than a function pointer or functor, or else Wait and Passed could
be combined.
void Abort (AbortReason reason)
Signals that the death test did not die as expected.
const char * LastMessage ()
Returns a human-readable outcome message regarding the outcome of
the last death test.
void set_last_death_test_message (const std::string & message)
void ~DeathTest ()
Defined at line 112 of file ../../third_party/googletest/src/googletest/include/gtest/internal/gtest-death-test-internal.h
Enumerations
enum TestRole
| Name | Value |
|---|---|
| OVERSEE_TEST | 0 |
| EXECUTE_TEST | 1 |
An enumeration of possible roles that may be taken when a death
test is encountered. EXECUTE means that the death test logic should
be executed immediately. OVERSEE means that the program should prepare
the appropriate environment for a child process to execute the death
test, then wait for it to complete.
Defined at line 131 of file ../../third_party/googletest/src/googletest/include/gtest/internal/gtest-death-test-internal.h
enum AbortReason
| Name | Value |
|---|---|
| TEST_ENCOUNTERED_RETURN_STATEMENT | 0 |
| TEST_THREW_EXCEPTION | 1 |
| TEST_DID_NOT_DIE | 2 |
An enumeration of the three reasons that a test might be aborted.
Defined at line 134 of file ../../third_party/googletest/src/googletest/include/gtest/internal/gtest-death-test-internal.h