summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Format/CleanupTest.cpp
diff options
context:
space:
mode:
authorEric Liu <ioeric@google.com>2016-12-19 10:41:05 +0000
committerEric Liu <ioeric@google.com>2016-12-19 10:41:05 +0000
commit93459d3142e78bec125075c6b455b734fb7dfc5a (patch)
tree785bc332794881335682b68885900ef5bc2e337b /clang/unittests/Format/CleanupTest.cpp
parent9949ead55ad85698096af2fda29e8c6bb00a09b9 (diff)
downloadbcm5719-llvm-93459d3142e78bec125075c6b455b734fb7dfc5a.tar.gz
bcm5719-llvm-93459d3142e78bec125075c6b455b734fb7dfc5a.zip
[clang-format] revert an unintended change in r288493 and add a test case.
llvm-svn: 290093
Diffstat (limited to 'clang/unittests/Format/CleanupTest.cpp')
-rw-r--r--clang/unittests/Format/CleanupTest.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/clang/unittests/Format/CleanupTest.cpp b/clang/unittests/Format/CleanupTest.cpp
index dbf3f070476..6ac5f695d43 100644
--- a/clang/unittests/Format/CleanupTest.cpp
+++ b/clang/unittests/Format/CleanupTest.cpp
@@ -714,6 +714,19 @@ TEST_F(CleanUpReplacementsTest, IfNDefWithNoDefine) {
EXPECT_EQ(Expected, apply(Code, Replaces));
}
+TEST_F(CleanUpReplacementsTest, FakeHeaderGuard) {
+ std::string Code = "// comment \n"
+ "#ifndef X\n"
+ "#define 1\n";
+ std::string Expected = "// comment \n"
+ "#include <vector>\n"
+ "#ifndef X\n"
+ "#define 1\n";
+ tooling::Replacements Replaces =
+ toReplacements({createInsertion("#include <vector>")});
+ EXPECT_EQ(Expected, apply(Code, Replaces));
+}
+
TEST_F(CleanUpReplacementsTest, HeaderGuardWithComment) {
std::string Code = "// comment \n"
"#ifndef X // comment\n"
OpenPOWER on IntegriCloud