Author: mydeveloperday Date: 2020-05-20T21:11:10+01:00 New Revision: 166ebefd27ac71e3f911f3d7ba0e168464d372af
URL: https://github.com/llvm/llvm-project/commit/166ebefd27ac71e3f911f3d7ba0e168464d372af DIFF: https://github.com/llvm/llvm-project/commit/166ebefd27ac71e3f911f3d7ba0e168464d372af.diff LOG: [clang-format] Set of unit test to begin to validate that we don't change defaults Summary: This revision is to complement {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. Reviewed By: MarcusJohnson91 Subscribers: cfe-commits Tags: #clang, #clang-format Differential Revision: https: Added: Modified: clang/unittests/Format/FormatTest.cpp Removed: ################################################################################ diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index 356edf248e67..ff31601e537a 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -16466,6 +16466,58 @@ TEST_F(FormatTest, LikelyUnlikely) { Style); } +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); +} +TEST_F(FormatTest, WebKitDefaultStyle) { + FormatStyle Style = getWebKitStyle(); + verifyFormat("extern \"C\" {\n" + "int foo();\n" + "}", + Style); +} } // namespace } // namespace format } // namespace clang _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits