summaryrefslogtreecommitdiff
path: root/absl/strings/string_view_test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'absl/strings/string_view_test.cc')
-rw-r--r--absl/strings/string_view_test.cc16
1 files changed, 13 insertions, 3 deletions
diff --git a/absl/strings/string_view_test.cc b/absl/strings/string_view_test.cc
index bb149d5c..fffa7b99 100644
--- a/absl/strings/string_view_test.cc
+++ b/absl/strings/string_view_test.cc
@@ -29,6 +29,15 @@
#include "absl/base/config.h"
#include "absl/base/dynamic_annotations.h"
+#ifdef __ANDROID__
+// Android assert messages only go to system log, so death tests cannot inspect
+// the message for matching.
+#define ABSL_EXPECT_DEATH_IF_SUPPORTED(statement, regex) \
+ EXPECT_DEATH_IF_SUPPORTED(statement, ".*")
+#else
+#define ABSL_EXPECT_DEATH_IF_SUPPORTED EXPECT_DEATH_IF_SUPPORTED
+#endif
+
namespace {
// A minimal allocator that uses malloc().
@@ -1068,7 +1077,8 @@ TEST(HugeStringView, TwoPointTwoGB) {
#if !defined(NDEBUG) && !defined(ABSL_HAVE_STD_STRING_VIEW)
TEST(NonNegativeLenTest, NonNegativeLen) {
- EXPECT_DEATH_IF_SUPPORTED(absl::string_view("xyz", -1), "len <= kMaxSize");
+ ABSL_EXPECT_DEATH_IF_SUPPORTED(absl::string_view("xyz", -1),
+ "len <= kMaxSize");
}
TEST(LenExceedsMaxSizeTest, LenExceedsMaxSize) {
@@ -1078,8 +1088,8 @@ TEST(LenExceedsMaxSizeTest, LenExceedsMaxSize) {
absl::string_view ok_view("", max_size);
// Adding one to the max should trigger an assertion.
- EXPECT_DEATH_IF_SUPPORTED(absl::string_view("", max_size + 1),
- "len <= kMaxSize");
+ ABSL_EXPECT_DEATH_IF_SUPPORTED(absl::string_view("", max_size + 1),
+ "len <= kMaxSize");
}
#endif // !defined(NDEBUG) && !defined(ABSL_HAVE_STD_STRING_VIEW)