MyDeveloperDay created this revision. MyDeveloperDay added reviewers: MarcusJohnson91, krasimir, JakeMerdichAMD. MyDeveloperDay added projects: clang, clang-format.
This revision is to complement D75791: [clang-format] Added new option IndentExternBlock <https://reviews.llvm.org/D75791> so we can be sure that we don't change any default behavior. For now just add rules to cover AfterExternBlock, but in the future we should add cases to cover the other BraceWrapping rules for each style. This will help guard us when we change code inside of the various getXXXStyle() functions to ensure we are not breaking everyone. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D80214 Files: clang/unittests/Format/FormatTest.cpp Index: clang/unittests/Format/FormatTest.cpp =================================================================== --- clang/unittests/Format/FormatTest.cpp +++ clang/unittests/Format/FormatTest.cpp @@ -16306,6 +16306,51 @@ Style)); } -} // namespace +TEST_F(FormatTest, LLVMDefaultStyle) { + FormatStyle Style = getLLVMStyle(); + verifyFormat("extern \"C\" {\n" + "int foo();\n" + "}", + Style); +} +TEST_F(FormatTest, GNUDefaultStyle) { + FormatStyle Style = getGNUStyle(); + verifyFormat("extern \"C\"\n" + "{\n" + " int foo ();\n" + "}", + Style); +} +TEST_F(FormatTest, MozillaDefaultStyle) { + FormatStyle Style = getMozillaStyle(); + verifyFormat("extern \"C\"\n" + "{\n" + " int foo();\n" + "}", + Style); +} +TEST_F(FormatTest, GoogleDefaultStyle) { + FormatStyle Style = getGoogleStyle(); + verifyFormat("extern \"C\" {\n" + "int foo();\n" + "}", + Style); +} +TEST_F(FormatTest, ChromiumDefaultStyle) { + FormatStyle Style = getChromiumStyle(FormatStyle::LanguageKind::LK_Cpp); + verifyFormat("extern \"C\" {\n" + "int foo();\n" + "}", + Style); +} +TEST_F(FormatTest, MicrosoftDefaultStyle) { + FormatStyle Style = getMicrosoftStyle(FormatStyle::LanguageKind::LK_Cpp); + verifyFormat("extern \"C\"\n" + "{\n" + " int foo();\n" + "}", + Style); +} +} } // namespace format } // namespace clang
Index: clang/unittests/Format/FormatTest.cpp =================================================================== --- clang/unittests/Format/FormatTest.cpp +++ clang/unittests/Format/FormatTest.cpp @@ -16306,6 +16306,51 @@ Style)); } -} // namespace +TEST_F(FormatTest, LLVMDefaultStyle) { + FormatStyle Style = getLLVMStyle(); + verifyFormat("extern \"C\" {\n" + "int foo();\n" + "}", + Style); +} +TEST_F(FormatTest, GNUDefaultStyle) { + FormatStyle Style = getGNUStyle(); + verifyFormat("extern \"C\"\n" + "{\n" + " int foo ();\n" + "}", + Style); +} +TEST_F(FormatTest, MozillaDefaultStyle) { + FormatStyle Style = getMozillaStyle(); + verifyFormat("extern \"C\"\n" + "{\n" + " int foo();\n" + "}", + Style); +} +TEST_F(FormatTest, GoogleDefaultStyle) { + FormatStyle Style = getGoogleStyle(); + verifyFormat("extern \"C\" {\n" + "int foo();\n" + "}", + Style); +} +TEST_F(FormatTest, ChromiumDefaultStyle) { + FormatStyle Style = getChromiumStyle(FormatStyle::LanguageKind::LK_Cpp); + verifyFormat("extern \"C\" {\n" + "int foo();\n" + "}", + Style); +} +TEST_F(FormatTest, MicrosoftDefaultStyle) { + FormatStyle Style = getMicrosoftStyle(FormatStyle::LanguageKind::LK_Cpp); + verifyFormat("extern \"C\"\n" + "{\n" + " int foo();\n" + "}", + Style); +} +} } // namespace format } // namespace clang
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits