diff options
author | Danil Sidoruk <patriotrossii2019@mail.ru> | 2022-09-25 21:07:18 -0700 |
---|---|---|
committer | Owen Pan <owenpiano@gmail.com> | 2022-09-25 21:10:26 -0700 |
commit | 258d7b86eeab4222c783c1a19acd8e18cd7745aa (patch) | |
tree | 008799ee1d03af1b592c30b8fb4e82323f7edf0a /clang/unittests/Format/FormatTestCSharp.cpp | |
parent | 75404e9ef88335d502dc3cf9b5d4f666563cd0c1 (diff) | |
download | llvm-258d7b86eeab4222c783c1a19acd8e18cd7745aa.zip llvm-258d7b86eeab4222c783c1a19acd8e18cd7745aa.tar.gz llvm-258d7b86eeab4222c783c1a19acd8e18cd7745aa.tar.bz2 |
[clang-format] Handle constructor invocations after new operator in C# correct
Fixes #56549.
Differential Revision: https://reviews.llvm.org/D129926
Diffstat (limited to 'clang/unittests/Format/FormatTestCSharp.cpp')
-rw-r--r-- | clang/unittests/Format/FormatTestCSharp.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTestCSharp.cpp b/clang/unittests/Format/FormatTestCSharp.cpp index 680a957..47ad779 100644 --- a/clang/unittests/Format/FormatTestCSharp.cpp +++ b/clang/unittests/Format/FormatTestCSharp.cpp @@ -617,6 +617,24 @@ var x = foo(className, $@"some code: EXPECT_EQ(Code, format(Code, Style)); } +TEST_F(FormatTestCSharp, CSharpNewOperator) { + FormatStyle Style = getLLVMStyle(FormatStyle::LK_CSharp); + + verifyFormat("public void F() {\n" + " var v = new C(() => { var t = 5; });\n" + "}", + Style); + verifyFormat("public void F() {\n" + " var v = new C(() => {\n" + " try {\n" + " } catch {\n" + " var t = 5;\n" + " }\n" + " });\n" + "}", + Style); +} + TEST_F(FormatTestCSharp, CSharpLambdas) { FormatStyle GoogleStyle = getGoogleStyle(FormatStyle::LK_CSharp); FormatStyle MicrosoftStyle = getMicrosoftStyle(FormatStyle::LK_CSharp); |