[PATCH] D146995: [clang-format][NFC] Refactor unit tests for "LambdaBodyIndentation: OuterScope" option.

2023-04-01 Thread Owen Pan via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG1dd31ebe5418: [clang-format][NFC] Refactor unit tests for 
LambdaBodyIndentation: OuterScope (authored by jp4a50, committed by 
owenpan).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146995/new/

https://reviews.llvm.org/D146995

Files:
  clang/unittests/Format/FormatTest.cpp

Index: clang/unittests/Format/FormatTest.cpp
===
--- clang/unittests/Format/FormatTest.cpp
+++ clang/unittests/Format/FormatTest.cpp
@@ -21956,51 +21956,59 @@
LLVMWithBeforeLambdaBody);
 
   // Lambdas with different indentation styles.
-  Style = getLLVMStyleWithColumns(100);
-  EXPECT_EQ("SomeResult doSomething(SomeObject promise) {\n"
-"  return promise.then(\n"
-"  [this, , someObject = "
-"std::mv(s)](std::vector evaluated) mutable {\n"
-"return someObject.startAsyncAction().then(\n"
-"[this, ](AsyncActionResult result) "
-"mutable { result.processMore(); });\n"
-"  });\n"
-"}\n",
-format("SomeResult doSomething(SomeObject promise) {\n"
-   "  return promise.then([this, , someObject = "
-   "std::mv(s)](std::vector evaluated) mutable {\n"
-   "return someObject.startAsyncAction().then([this, "
-   "](AsyncActionResult result) mutable {\n"
-   "  result.processMore();\n"
-   "});\n"
-   "  });\n"
-   "}\n",
-   Style));
+  Style = getLLVMStyleWithColumns(60);
+  verifyFormat("Result doSomething(Promise promise) {\n"
+   "  return promise.then(\n"
+   "  [this, obj = std::move(s)](int bar) mutable {\n"
+   "return someObject.startAsyncAction().then(\n"
+   "[this, ](Result result) mutable {\n"
+   "  result.processMore();\n"
+   "});\n"
+   "  });\n"
+   "}\n",
+   Style);
   Style.LambdaBodyIndentation = FormatStyle::LBI_OuterScope;
-  verifyFormat("test() {\n"
-   "  ([]() -> {\n"
+  verifyFormat("Result doSomething(Promise promise) {\n"
+   "  return promise.then(\n"
+   "  [this, obj = std::move(s)](int bar) mutable {\n"
+   "return obj.startAsyncAction().then(\n"
+   "[this, ](Result result) mutable {\n"
+   "  result.processMore();\n"
+   "});\n"
+   "  });\n"
+   "}\n",
+   Style);
+  verifyFormat("Result doSomething(Promise promise) {\n"
+   "  return promise.then([this, obj = std::move(s)] {\n"
+   "return obj.startAsyncAction().then(\n"
+   "[this, ](Result result) mutable {\n"
+   "  result.processMore();\n"
+   "});\n"
+   "  });\n"
+   "}\n",
+   Style);
+  verifyFormat("void test() {\n"
+   "  ([]() -> auto {\n"
"int b = 32;\n"
"return 3;\n"
"  }).foo();\n"
"}",
Style);
-  verifyFormat("test() {\n"
-   "  []() -> {\n"
+  verifyFormat("void test() {\n"
+   "  []() -> auto {\n"
"int b = 32;\n"
"return 3;\n"
"  }\n"
"}",
Style);
   verifyFormat("std::sort(v.begin(), v.end(),\n"
-   "  [](const auto , const auto "
-   ") {\n"
-   "  return someLongArgumentName.someMemberVariable < "
-   "someOtherLongArgumentName.someMemberVariable;\n"
-   "});",
+   "  [](const auto , const auto ) {\n"
+   "  return foo.baz < bar.baz;\n"
+   "});\n",
Style);
-  verifyFormat("test() {\n"
+  verifyFormat("void test() {\n"
"  (\n"
-   "  []() -> {\n"
+   "  []() -> auto {\n"
"int b = 32;\n"
"return 3;\n"
"  },\n"
@@ -22008,8 +22016,8 @@
"  .foo();\n"
"}",
Style);
-  verifyFormat("test() {\n"
-   "  ([]() -> {\n"
+  verifyFormat("void test() {\n"
+   "  ([]() -> auto {\n"
"int b = 32;\n"
"return 3;\n"
"  })\n"
@@ -22017,51 +22025,14 @@
"  .bar();\n"
"}",
Style);
-  EXPECT_EQ("SomeResult doSomething(SomeObject promise) {\n"
-"  

[PATCH] D146995: [clang-format][NFC] Refactor unit tests for "LambdaBodyIndentation: OuterScope" option.

2023-03-28 Thread Jon Phillips via Phabricator via cfe-commits
jp4a50 added a comment.

> You need to state a name and email for the commit.

Name: Jon Phillips
Email: jonap2...@gmail.com

Also, thanks for relating the child diff to this one. I couldn't see how to do 
it at first but have seen the option now.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146995/new/

https://reviews.llvm.org/D146995

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D146995: [clang-format][NFC] Refactor unit tests for "LambdaBodyIndentation: OuterScope" option.

2023-03-28 Thread Björn Schäpers via Phabricator via cfe-commits
HazardyKnusperkeks added a comment.

In D146995#4227532 , @jp4a50 wrote:

> If you guys are happy with this, could you please merge it for me?

You need to state a name and email for the commit.

> Edit: Also could you please advise about the failing CI test? It doesn't look 
> like it's anything to do with my changes but do let me know if that's not the 
> case.

If you have checked your code does compile and run on your side and the 
reported error is not in clang-format you can just ignore it.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146995/new/

https://reviews.llvm.org/D146995

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D146995: [clang-format][NFC] Refactor unit tests for "LambdaBodyIndentation: OuterScope" option.

2023-03-28 Thread Jon Phillips via Phabricator via cfe-commits
jp4a50 added a comment.

If you guys are happy with this, could you please merge it for me?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146995/new/

https://reviews.llvm.org/D146995

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits