googletest-throw-on-failure-test_.cc (googletest-release-1.11.0) | : | googletest-throw-on-failure-test_.cc (googletest-release-1.12.0) | ||
---|---|---|---|---|
skipping to change at line 36 | skipping to change at line 36 | |||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
// Tests Google Test's throw-on-failure mode with exceptions disabled. | // Tests Google Test's throw-on-failure mode with exceptions disabled. | |||
// | // | |||
// This program must be compiled with exceptions disabled. It will be | // This program must be compiled with exceptions disabled. It will be | |||
// invoked by googletest-throw-on-failure-test.py, and is expected to exit | // invoked by googletest-throw-on-failure-test.py, and is expected to exit | |||
// with non-zero in the throw-on-failure mode or 0 otherwise. | // with non-zero in the throw-on-failure mode or 0 otherwise. | |||
#include "gtest/gtest.h" | #include <stdio.h> // for fflush, fprintf, NULL, etc. | |||
#include <stdlib.h> // for exit | ||||
#include <exception> // for set_terminate | ||||
#include <stdio.h> // for fflush, fprintf, NULL, etc. | #include "gtest/gtest.h" | |||
#include <stdlib.h> // for exit | ||||
#include <exception> // for set_terminate | ||||
// This terminate handler aborts the program using exit() rather than abort(). | // This terminate handler aborts the program using exit() rather than abort(). | |||
// This avoids showing pop-ups on Windows systems and core dumps on Unix-like | // This avoids showing pop-ups on Windows systems and core dumps on Unix-like | |||
// ones. | // ones. | |||
void TerminateHandler() { | void TerminateHandler() { | |||
fprintf(stderr, "%s\n", "Unhandled C++ exception terminating the program."); | fprintf(stderr, "%s\n", "Unhandled C++ exception terminating the program."); | |||
fflush(nullptr); | fflush(nullptr); | |||
exit(1); | exit(1); | |||
} | } | |||
End of changes. 2 change blocks. | ||||
4 lines changed or deleted | 5 lines changed or added |