aboutsummaryrefslogtreecommitdiff
path: root/clang/unittests/Format/FormatTestCSharp.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/unittests/Format/FormatTestCSharp.cpp')
-rw-r--r--clang/unittests/Format/FormatTestCSharp.cpp18
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);