2009-12-18 20:35:38 +00:00
|
|
|
//===- llvm/unittest/LeakDetector/LeakDetector.cpp - LeakDetector tests ---===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "gtest/gtest.h"
|
|
|
|
#include "llvm/Support/LeakDetector.h"
|
|
|
|
|
|
|
|
using namespace llvm;
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
|
|
|
#ifdef GTEST_HAS_DEATH_TEST
|
2010-03-17 01:18:45 +00:00
|
|
|
#ifndef NDEBUG
|
2009-12-18 20:35:38 +00:00
|
|
|
TEST(LeakDetector, Death1) {
|
|
|
|
LeakDetector::addGarbageObject((void*) 1);
|
|
|
|
LeakDetector::addGarbageObject((void*) 2);
|
|
|
|
|
|
|
|
EXPECT_DEATH(LeakDetector::addGarbageObject((void*) 1),
|
|
|
|
".*Ts.count\\(o\\) == 0 && \"Object already in set!\"");
|
|
|
|
EXPECT_DEATH(LeakDetector::addGarbageObject((void*) 2),
|
|
|
|
"Cache != o && \"Object already in set!\"");
|
|
|
|
}
|
|
|
|
#endif
|
2010-03-17 01:18:45 +00:00
|
|
|
#endif
|
2009-12-18 20:35:38 +00:00
|
|
|
|
|
|
|
}
|