diff options
Diffstat (limited to 'clang/unittests/Format/ConfigParseTest.cpp')
-rw-r--r-- | clang/unittests/Format/ConfigParseTest.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/clang/unittests/Format/ConfigParseTest.cpp b/clang/unittests/Format/ConfigParseTest.cpp index 5b9055d..aedfdd1 100644 --- a/clang/unittests/Format/ConfigParseTest.cpp +++ b/clang/unittests/Format/ConfigParseTest.cpp @@ -1267,6 +1267,24 @@ TEST(ConfigParseTest, AllowCppForC) { ParseError::Success); } +TEST(ConfigParseTest, HandleNonCppDotHFile) { + FormatStyle Style = {}; + Style.Language = FormatStyle::LK_Cpp; + EXPECT_EQ(parseConfiguration("Language: C", &Style, + /*AllowUnknownOptions=*/false, + /*IsDotHFile=*/true), + ParseError::Success); + EXPECT_EQ(Style.Language, FormatStyle::LK_C); + + Style = {}; + Style.Language = FormatStyle::LK_Cpp; + EXPECT_EQ(parseConfiguration("Language: ObjC", &Style, + /*AllowUnknownOptions=*/false, + /*IsDotHFile=*/true), + ParseError::Success); + EXPECT_EQ(Style.Language, FormatStyle::LK_ObjC); +} + TEST(ConfigParseTest, UsesLanguageForBasedOnStyle) { FormatStyle Style = {}; Style.Language = FormatStyle::LK_JavaScript; |