summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Tooling/HeaderIncludesTest.cpp
diff options
context:
space:
mode:
authorEric Liu <ioeric@google.com>2019-01-29 14:40:01 +0000
committerEric Liu <ioeric@google.com>2019-01-29 14:40:01 +0000
commit247396130587bd3f43c6553fd6517f53ea4f43d6 (patch)
tree8f86829ed691cadebc153fb76bdbe0e8748a5793 /clang/unittests/Tooling/HeaderIncludesTest.cpp
parenta9638210528d84d9b3a88ebeb174d44442b9dc15 (diff)
downloadbcm5719-llvm-247396130587bd3f43c6553fd6517f53ea4f43d6.tar.gz
bcm5719-llvm-247396130587bd3f43c6553fd6517f53ea4f43d6.zip
[Tooling] Handle #pragma once header guard in include insertion.
Reviewers: ilya-biryukov Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D57223 llvm-svn: 352503
Diffstat (limited to 'clang/unittests/Tooling/HeaderIncludesTest.cpp')
-rw-r--r--clang/unittests/Tooling/HeaderIncludesTest.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/clang/unittests/Tooling/HeaderIncludesTest.cpp b/clang/unittests/Tooling/HeaderIncludesTest.cpp
index 2daa58e5558..635d7ebb1e9 100644
--- a/clang/unittests/Tooling/HeaderIncludesTest.cpp
+++ b/clang/unittests/Tooling/HeaderIncludesTest.cpp
@@ -14,9 +14,6 @@
#include "gtest/gtest.h"
-using clang::tooling::ReplacementTest;
-using clang::tooling::toReplacements;
-
namespace clang {
namespace tooling {
namespace {
@@ -315,6 +312,17 @@ TEST_F(HeaderIncludesTest, RealHeaderGuardAfterComments) {
EXPECT_EQ(Expected, insert(Code, "<vector>"));
}
+TEST_F(HeaderIncludesTest, PragmaOnce) {
+ std::string Code = "// comment \n"
+ "#pragma once\n"
+ "int x;\n";
+ std::string Expected = "// comment \n"
+ "#pragma once\n"
+ "#include <vector>\n"
+ "int x;\n";
+ EXPECT_EQ(Expected, insert(Code, "<vector>"));
+}
+
TEST_F(HeaderIncludesTest, IfNDefWithNoDefine) {
std::string Code = "// comment \n"
"#ifndef X\n"
OpenPOWER on IntegriCloud