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.cpp116
1 files changed, 116 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTestCSharp.cpp b/clang/unittests/Format/FormatTestCSharp.cpp
index 651b54c..3c99033 100644
--- a/clang/unittests/Format/FormatTestCSharp.cpp
+++ b/clang/unittests/Format/FormatTestCSharp.cpp
@@ -640,6 +640,122 @@ class MyClass
};
})",
MicrosoftStyle);
+
+ verifyFormat("void bar()\n"
+ "{\n"
+ " Function(Val, (Action)(() =>\n"
+ " {\n"
+ " lock (mylock)\n"
+ " {\n"
+ " if (true)\n"
+ " {\n"
+ " A.Remove(item);\n"
+ " }\n"
+ " }\n"
+ " }));\n"
+ "}",
+ MicrosoftStyle);
+
+ verifyFormat("void baz()\n"
+ "{\n"
+ " Function(Val, (Action)(() =>\n"
+ " {\n"
+ " using (var a = new Lock())\n"
+ " {\n"
+ " if (true)\n"
+ " {\n"
+ " A.Remove(item);\n"
+ " }\n"
+ " }\n"
+ " }));\n"
+ "}",
+ MicrosoftStyle);
+
+ verifyFormat("void baz()\n"
+ "{\n"
+ " Function(Val, (Action)(() =>\n"
+ " {\n"
+ " if (true)\n"
+ " {\n"
+ " A.Remove(item);\n"
+ " }\n"
+ " }));\n"
+ "}",
+ MicrosoftStyle);
+
+ verifyFormat("void baz()\n"
+ "{\n"
+ " Function(Val, (Action)(() =>\n"
+ " {\n"
+ " do\n"
+ " {\n"
+ " A.Remove(item);\n"
+ " } while (true)\n"
+ " }));\n"
+ "}",
+ MicrosoftStyle);
+
+ verifyFormat("void baz()\n"
+ "{\n"
+ " Function(Val, (Action)(() =>\n"
+ " { A.Remove(item); }));\n"
+ "}",
+ MicrosoftStyle);
+
+ verifyFormat("void bar()\n"
+ "{\n"
+ " Function(Val, (() =>\n"
+ " {\n"
+ " lock (mylock)\n"
+ " {\n"
+ " if (true)\n"
+ " {\n"
+ " A.Remove(item);\n"
+ " }\n"
+ " }\n"
+ " }));\n"
+ "}",
+ MicrosoftStyle);
+ verifyFormat("void bar()\n"
+ "{\n"
+ " Function((() =>\n"
+ " {\n"
+ " lock (mylock)\n"
+ " {\n"
+ " if (true)\n"
+ " {\n"
+ " A.Remove(item);\n"
+ " }\n"
+ " }\n"
+ " }));\n"
+ "}",
+ MicrosoftStyle);
+
+ MicrosoftStyle.IndentWidth = 2;
+ verifyFormat("void bar()\n"
+ "{\n"
+ " Function((() =>\n"
+ " {\n"
+ " lock (mylock)\n"
+ " {\n"
+ " if (true)\n"
+ " {\n"
+ " A.Remove(item);\n"
+ " }\n"
+ " }\n"
+ " }));\n"
+ "}",
+ MicrosoftStyle);
+ verifyFormat("void bar() {\n"
+ " Function((() => {\n"
+ " lock (mylock) {\n"
+ " if (true) {\n"
+ " A.Remove(item);\n"
+ " }\n"
+ " }\n"
+ " }));\n"
+ "}",
+ GoogleStyle);
}
TEST_F(FormatTestCSharp, CSharpObjectInitializers) {