[clang] 95c1a17 - [clang-format] add config parse test for short lambda

via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 16 05:37:07 PST 2022


Author: Backl1ght
Date: 2022-12-16T21:36:07+08:00
New Revision: 95c1a17433b972e8345b672f69005204dab0916d

URL: https://github.com/llvm/llvm-project/commit/95c1a17433b972e8345b672f69005204dab0916d
DIFF: https://github.com/llvm/llvm-project/commit/95c1a17433b972e8345b672f69005204dab0916d.diff

LOG: [clang-format] add config parse test for short lambda

Reviewed By: HazardyKnusperkeks, MyDeveloperDay
Differential Revision: https://reviews.llvm.org/D140105

Added: 
    

Modified: 
    clang/unittests/Format/ConfigParseTest.cpp

Removed: 
    


################################################################################
diff  --git a/clang/unittests/Format/ConfigParseTest.cpp b/clang/unittests/Format/ConfigParseTest.cpp
index a65fffc7b57f2..777b2c26e61c5 100644
--- a/clang/unittests/Format/ConfigParseTest.cpp
+++ b/clang/unittests/Format/ConfigParseTest.cpp
@@ -533,6 +533,21 @@ TEST(ConfigParseTest, ParsesConfiguration) {
   CHECK_PARSE("AllowShortFunctionsOnASingleLine: true",
               AllowShortFunctionsOnASingleLine, FormatStyle::SFS_All);
 
+  Style.AllowShortLambdasOnASingleLine = FormatStyle::SLS_All;
+  CHECK_PARSE("AllowShortLambdasOnASingleLine: None",
+              AllowShortLambdasOnASingleLine, FormatStyle::SLS_None);
+  CHECK_PARSE("AllowShortLambdasOnASingleLine: Empty",
+              AllowShortLambdasOnASingleLine, FormatStyle::SLS_Empty);
+  CHECK_PARSE("AllowShortLambdasOnASingleLine: Inline",
+              AllowShortLambdasOnASingleLine, FormatStyle::SLS_Inline);
+  CHECK_PARSE("AllowShortLambdasOnASingleLine: All",
+              AllowShortLambdasOnASingleLine, FormatStyle::SLS_All);
+  // For backward compatibility:
+  CHECK_PARSE("AllowShortLambdasOnASingleLine: false",
+              AllowShortLambdasOnASingleLine, FormatStyle::SLS_None);
+  CHECK_PARSE("AllowShortLambdasOnASingleLine: true",
+              AllowShortLambdasOnASingleLine, FormatStyle::SLS_All);
+
   Style.SpaceAroundPointerQualifiers = FormatStyle::SAPQ_Both;
   CHECK_PARSE("SpaceAroundPointerQualifiers: Default",
               SpaceAroundPointerQualifiers, FormatStyle::SAPQ_Default);


        


More information about the cfe-commits mailing list