diff options
| author | qrort <[email protected]> | 2022-11-30 23:47:12 +0300 |
|---|---|---|
| committer | qrort <[email protected]> | 2022-11-30 23:47:12 +0300 |
| commit | 22f8ae0e3f5d68b92aecccdf96c1d841a0334311 (patch) | |
| tree | bffa27765faf54126ad44bcafa89fadecb7a73d7 /library/cpp/yt/logging/unittests/logger_ut.cpp | |
| parent | 332b99e2173f0425444abb759eebcb2fafaa9209 (diff) | |
validate canons without yatest_common
Diffstat (limited to 'library/cpp/yt/logging/unittests/logger_ut.cpp')
| -rw-r--r-- | library/cpp/yt/logging/unittests/logger_ut.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/library/cpp/yt/logging/unittests/logger_ut.cpp b/library/cpp/yt/logging/unittests/logger_ut.cpp new file mode 100644 index 00000000000..7696ea4a83b --- /dev/null +++ b/library/cpp/yt/logging/unittests/logger_ut.cpp @@ -0,0 +1,38 @@ +#include <library/cpp/testing/gtest/gtest.h> + +#include <library/cpp/yt/logging/logger.h> + +namespace NYT::NLogging { +namespace { + +//////////////////////////////////////////////////////////////////////////////// + +TEST(TLogger, NullByDefault) +{ + { + TLogger logger; + EXPECT_FALSE(logger); + EXPECT_FALSE(logger.IsLevelEnabled(ELogLevel::Fatal)); + } + { + TLogger logger{"Category"}; + EXPECT_FALSE(logger); + EXPECT_FALSE(logger.IsLevelEnabled(ELogLevel::Fatal)); + } +} + +TEST(TLogger, CopyOfNullLogger) +{ + TLogger nullLogger{/*logManager*/ nullptr, "Category"}; + ASSERT_FALSE(nullLogger); + + auto logger = nullLogger.WithMinLevel(ELogLevel::Debug); + + EXPECT_FALSE(logger); + EXPECT_FALSE(logger.IsLevelEnabled(ELogLevel::Fatal)); +} + +//////////////////////////////////////////////////////////////////////////////// + +} // namespace +} // namespace NYT::NLogging |
