diff options
author | Daniel Jasper <djasper@google.com> | 2013-02-19 17:14:38 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2013-02-19 17:14:38 +0000 |
commit | 34511fb79201ba9ed39c97f3a7ea0f157a79436d (patch) | |
tree | 412000941bdd0b10523502d2f8047bce3d807d9e /unittests/Format/FormatTest.cpp | |
parent | 523806028d812a7f29636c59a8bc0e7e3d3fd9ae (diff) |
Correctly format macro with unfinished template declaration.
We can now format:
#define A template <typename T>
Before this created a segfault :-/.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175533 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/Format/FormatTest.cpp')
-rw-r--r-- | unittests/Format/FormatTest.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp index fb388ab7f9..3a1e9dce95 100644 --- a/unittests/Format/FormatTest.cpp +++ b/unittests/Format/FormatTest.cpp @@ -378,12 +378,6 @@ TEST_F(FormatTest, FormatsSwitchStatement) { verifyFormat("switch (test)\n" " ;"); - // FIXME: Improve formatting of case labels in macros. - verifyFormat("#define SOMECASES \\\n" - "case 1: \\\n" - " case 2\n", - getLLVMStyleWithColumns(20)); - verifyGoogleFormat("switch (x) {\n" " case 1:\n" " f();\n" @@ -935,6 +929,16 @@ TEST_F(FormatTest, EmptyLinesInMacroDefinitions) { getLLVMStyleWithColumns(11))); } +TEST_F(FormatTest, MacroDefinitionsWithIncompleteCode) { + // FIXME: Improve formatting of case labels in macros. + verifyFormat("#define SOMECASES \\\n" + "case 1: \\\n" + " case 2\n", + getLLVMStyleWithColumns(20)); + + verifyFormat("#define A template <typename T>"); +} + TEST_F(FormatTest, IndentPreprocessorDirectivesAtZero) { EXPECT_EQ("{\n {\n#define A\n }\n}", format("{{\n#define A\n}}")); } |