blob: 99a10734842bb509176ac098ce3e3da4e9893390 [file] [log] [blame]
mistergc2e75482017-09-19 16:54:40 -04001// Testing utilities for ABSL types which throw exceptions.
2
3#ifndef ABSL_BASE_INTERNAL_EXCEPTION_TESTING_H_
4#define ABSL_BASE_INTERNAL_EXCEPTION_TESTING_H_
5
6#include "gtest/gtest.h"
7#include "absl/base/config.h"
8
9// ABSL_BASE_INTERNAL_EXPECT_FAIL tests either for a specified thrown exception
10// if exceptions are enabled, or for death with a specified text in the error
11// message
12#ifdef ABSL_HAVE_EXCEPTIONS
13
14#define ABSL_BASE_INTERNAL_EXPECT_FAIL(expr, exception_t, text) \
15 EXPECT_THROW(expr, exception_t)
16
17#else
18
19#define ABSL_BASE_INTERNAL_EXPECT_FAIL(expr, exception_t, text) \
20 EXPECT_DEATH(expr, text)
21
22#endif
23
24#endif // ABSL_BASE_INTERNAL_EXCEPTION_TESTING_H_