@@ -2866,27 +2866,29 @@ TEST_F(FormatTest, ShortEnums) {
2866
2866
}
2867
2867
2868
2868
TEST_F(FormatTest, ShortCompoundRequirement) {
2869
+ constexpr StringRef Code("template <typename T>\n"
2870
+ "concept c = requires(T x) {\n"
2871
+ " { x + 1 } -> std::same_as<int>;\n"
2872
+ "};");
2873
+
2869
2874
FormatStyle Style = getLLVMStyle();
2870
2875
EXPECT_TRUE(Style.AllowShortCompoundRequirementOnASingleLine);
2871
- verifyFormat("template <typename T>\n"
2872
- "concept c = requires(T x) {\n"
2873
- " { x + 1 } -> std::same_as<int>;\n"
2874
- "};",
2875
- Style);
2876
+ verifyFormat(Code, Style);
2876
2877
verifyFormat("template <typename T>\n"
2877
2878
"concept c = requires(T x) {\n"
2878
2879
" { x + 1 } -> std::same_as<int>;\n"
2879
2880
" { x + 2 } -> std::same_as<int>;\n"
2880
2881
"};",
2881
2882
Style);
2883
+
2882
2884
Style.AllowShortCompoundRequirementOnASingleLine = false;
2883
2885
verifyFormat("template <typename T>\n"
2884
2886
"concept c = requires(T x) {\n"
2885
2887
" {\n"
2886
2888
" x + 1\n"
2887
2889
" } -> std::same_as<int>;\n"
2888
2890
"};",
2889
- Style);
2891
+ Code, Style);
2890
2892
verifyFormat("template <typename T>\n"
2891
2893
"concept c = requires(T x) {\n"
2892
2894
" {\n"
@@ -2897,6 +2899,11 @@ TEST_F(FormatTest, ShortCompoundRequirement) {
2897
2899
" } -> std::same_as<int>;\n"
2898
2900
"};",
2899
2901
Style);
2902
+
2903
+ Style.AllowShortCompoundRequirementOnASingleLine = true;
2904
+ Style.BreakBeforeBraces = FormatStyle::BS_Custom;
2905
+ Style.BraceWrapping.AfterControlStatement = FormatStyle::BWACS_MultiLine;
2906
+ verifyFormat(Code, Style);
2900
2907
}
2901
2908
2902
2909
TEST_F(FormatTest, ShortCaseLabels) {
0 commit comments