summaryrefslogtreecommitdiffstats
path: root/base/logging_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'base/logging_test.cpp')
-rw-r--r--base/logging_test.cpp24
1 files changed, 23 insertions, 1 deletions
diff --git a/base/logging_test.cpp b/base/logging_test.cpp
index 6a321fce5..3fde302a3 100644
--- a/base/logging_test.cpp
+++ b/base/logging_test.cpp
@@ -122,7 +122,9 @@ TEST(logging, CHECK) {
static std::string make_log_pattern(android::base::LogSeverity severity,
const char* message) {
- static const char* log_characters = "VDIWEF";
+ static const char log_characters[] = "VDIWEFF";
+ static_assert(arraysize(log_characters) - 1 == android::base::FATAL + 1,
+ "Mismatch in size of log_characters and values in LogSeverity");
char log_char = log_characters[severity];
std::string holder(__FILE__);
return android::base::StringPrintf(
@@ -164,6 +166,14 @@ TEST(logging, LOG_FATAL) {
ASSERT_DEATH({SuppressAbortUI(); LOG(FATAL) << "foobar";}, "foobar");
}
+TEST(logging, LOG_FATAL_WITHOUT_ABORT_disabled) {
+ CHECK_LOG_DISABLED(FATAL_WITHOUT_ABORT);
+}
+
+TEST(logging, LOG_FATAL_WITHOUT_ABORT_enabled) {
+ CHECK_LOG_ENABLED(FATAL_WITHOUT_ABORT);
+}
+
TEST(logging, LOG_ERROR_disabled) {
CHECK_LOG_DISABLED(ERROR);
}
@@ -260,6 +270,18 @@ TEST(logging, LOG_does_not_have_dangling_if) {
PLOG(severity) << "foobar"; \
CheckMessage(cap2, android::base::severity, "foobar: No such file or directory"); \
+TEST(logging, PLOG_FATAL) {
+ ASSERT_DEATH({SuppressAbortUI(); PLOG(FATAL) << "foobar";}, "foobar");
+}
+
+TEST(logging, PLOG_FATAL_WITHOUT_ABORT_disabled) {
+ CHECK_PLOG_DISABLED(FATAL_WITHOUT_ABORT);
+}
+
+TEST(logging, PLOG_FATAL_WITHOUT_ABORT_enabled) {
+ CHECK_PLOG_ENABLED(FATAL_WITHOUT_ABORT);
+}
+
TEST(logging, PLOG_ERROR_disabled) {
CHECK_PLOG_DISABLED(ERROR);
}