diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2014-11-24 09:08:18 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2014-11-24 09:08:18 +0000 |
commit | 5ca98fd98791947eba83a1ed3f2c8191ef7afa6c (patch) | |
tree | f5944309621cee4fe0976be6f9ac619b7ebfc4c2 /unittests/IR/LeakDetectorTest.cpp | |
parent | 68bcb7db193e4bc81430063148253d30a791023e (diff) |
Diffstat (limited to 'unittests/IR/LeakDetectorTest.cpp')
-rw-r--r-- | unittests/IR/LeakDetectorTest.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/unittests/IR/LeakDetectorTest.cpp b/unittests/IR/LeakDetectorTest.cpp new file mode 100644 index 000000000000..94eed4c1432b --- /dev/null +++ b/unittests/IR/LeakDetectorTest.cpp @@ -0,0 +1,31 @@ +//===- LeakDetectorTest.cpp -----------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "llvm/IR/LeakDetector.h" +#include "gtest/gtest.h" + +using namespace llvm; + +namespace { + +#ifdef GTEST_HAS_DEATH_TEST +#ifndef NDEBUG +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 +#endif + +} |