diff options
| author | Jordan Rupprecht <rupprecht@google.com> | 2019-03-13 21:13:01 +0000 |
|---|---|---|
| committer | Jordan Rupprecht <rupprecht@google.com> | 2019-03-13 21:13:01 +0000 |
| commit | 55881d5def969c9e41fca87b51018d470340a888 (patch) | |
| tree | 71c7eef5e2bf3d34976c97da6600c53a067f453e /clang/unittests/Format/FormatTest.cpp | |
| parent | ab41ea6282a75c3ece5cef037ced75f3f7acc724 (diff) | |
| download | bcm5719-llvm-55881d5def969c9e41fca87b51018d470340a888.tar.gz bcm5719-llvm-55881d5def969c9e41fca87b51018d470340a888.zip | |
[clang-format] Propagate inferred language to getLLVMStyle() in getPredefinedStyle()
rC355158 added an optional language parameter to getLLVMStyle(), but this parameter was not used in getPredefinedStyle(). Because unit tests directly specify the style, this codepath wasn't tested. Add an additional unit test for getStyle().
llvm-svn: 356099
Diffstat (limited to 'clang/unittests/Format/FormatTest.cpp')
| -rw-r--r-- | clang/unittests/Format/FormatTest.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index 7fcff46f581..09c49b4408e 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -12714,6 +12714,11 @@ TEST(FormatStyle, GetStyleOfFile) { auto Style7 = getStyle("file", "/d/.clang-format", "LLVM", "", &FS); ASSERT_FALSE((bool)Style7); llvm::consumeError(Style7.takeError()); + + // Test 8: inferred per-language defaults apply. + auto StyleTd = getStyle("file", "x.td", "llvm", "", &FS); + ASSERT_TRUE((bool)StyleTd); + ASSERT_EQ(*StyleTd, getLLVMStyle(FormatStyle::LK_TableGen)); } TEST_F(ReplacementTest, FormatCodeAfterReplacements) { |

