|
|
|||
File indexing completed on 2025-12-16 09:40:53
0001 // Copyright 2022 The Abseil Authors. 0002 // 0003 // Licensed under the Apache License, Version 2.0 (the "License"); 0004 // you may not use this file except in compliance with the License. 0005 // You may obtain a copy of the License at 0006 // 0007 // https://www.apache.org/licenses/LICENSE-2.0 0008 // 0009 // Unless required by applicable law or agreed to in writing, software 0010 // distributed under the License is distributed on an "AS IS" BASIS, 0011 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 0012 // See the License for the specific language governing permissions and 0013 // limitations under the License. 0014 // 0015 // ----------------------------------------------------------------------------- 0016 // File: log/internal/test_helpers.h 0017 // ----------------------------------------------------------------------------- 0018 // 0019 // This file declares testing helpers for the logging library. 0020 0021 #ifndef ABSL_LOG_INTERNAL_TEST_HELPERS_H_ 0022 #define ABSL_LOG_INTERNAL_TEST_HELPERS_H_ 0023 0024 #include "gtest/gtest.h" 0025 #include "absl/base/config.h" 0026 #include "absl/base/log_severity.h" 0027 #include "absl/log/globals.h" 0028 0029 namespace absl { 0030 ABSL_NAMESPACE_BEGIN 0031 namespace log_internal { 0032 0033 // `ABSL_MIN_LOG_LEVEL` can't be used directly since it is not always defined. 0034 constexpr auto kAbslMinLogLevel = 0035 #ifdef ABSL_MIN_LOG_LEVEL 0036 static_cast<absl::LogSeverityAtLeast>(ABSL_MIN_LOG_LEVEL); 0037 #else 0038 absl::LogSeverityAtLeast::kInfo; 0039 #endif 0040 0041 // Returns false if the specified severity level is disabled by 0042 // `ABSL_MIN_LOG_LEVEL` or `absl::MinLogLevel()`. 0043 bool LoggingEnabledAt(absl::LogSeverity severity); 0044 0045 // ----------------------------------------------------------------------------- 0046 // Googletest Death Test Predicates 0047 // ----------------------------------------------------------------------------- 0048 0049 #if GTEST_HAS_DEATH_TEST 0050 0051 bool DiedOfFatal(int exit_status); 0052 bool DiedOfQFatal(int exit_status); 0053 0054 #endif 0055 0056 // ----------------------------------------------------------------------------- 0057 // Helper for Log initialization in test 0058 // ----------------------------------------------------------------------------- 0059 0060 class LogTestEnvironment : public ::testing::Environment { 0061 public: 0062 ~LogTestEnvironment() override = default; 0063 0064 void SetUp() override; 0065 }; 0066 0067 } // namespace log_internal 0068 ABSL_NAMESPACE_END 0069 } // namespace absl 0070 0071 #endif // ABSL_LOG_INTERNAL_TEST_HELPERS_H_
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|