summaryrefslogtreecommitdiff
path: root/unittests/Format/FormatTestProto.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2016-06-20 18:20:38 +0000
committerDaniel Jasper <djasper@google.com>2016-06-20 18:20:38 +0000
commit2e5530af90722f6fa99967961029a13d65e47f7d (patch)
treedb3f7aea1f9d2ba699611f5c6844216abeb603dd /unittests/Format/FormatTestProto.cpp
parent55cabd988380b263f948129c468fbc0f3932abba (diff)
downloadclang-2e5530af90722f6fa99967961029a13d65e47f7d.tar.gz
clang-format: [Proto] Don't do bad things if imports are missing ;.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@273179 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/Format/FormatTestProto.cpp')
-rw-r--r--unittests/Format/FormatTestProto.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/unittests/Format/FormatTestProto.cpp b/unittests/Format/FormatTestProto.cpp
index d3d3d42aa8..68d724981c 100644
--- a/unittests/Format/FormatTestProto.cpp
+++ b/unittests/Format/FormatTestProto.cpp
@@ -189,5 +189,20 @@ TEST_F(FormatTestProto, ExtendingMessage) {
"}");
}
+TEST_F(FormatTestProto, FormatsImports) {
+ verifyFormat("import \"a.proto\";\n"
+ "import \"b.proto\";\n"
+ "// comment\n"
+ "message A {\n"
+ "}");
+
+ // Missing semicolons should not confuse clang-format.
+ verifyFormat("import \"a.proto\"\n"
+ "import \"b.proto\"\n"
+ "// comment\n"
+ "message A {\n"
+ "}");
+}
+
} // end namespace tooling
} // end namespace clang