#include <memory>
#include "gtest/gtest.h"
#include "absl/debugging/leak_check.h"
#include "absl/log/log.h"
namespace {
TEST(LeakCheckTest, LeakMemory) {
char* foo = strdup("lsan should complain about this leaked string");
LOG(INFO) << "Should detect leaked string " << foo;
}
TEST(LeakCheckTest, LeakMemoryAfterDisablerScope) {
{ absl::LeakCheckDisabler disabler; }
char* foo = strdup("lsan should also complain about this leaked string");
LOG(INFO) << "Re-enabled leak detection.Should detect leaked string " << foo;
}
}