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.cpp32
1 files changed, 30 insertions, 2 deletions
diff --git a/clang/unittests/Format/FormatTestCSharp.cpp b/clang/unittests/Format/FormatTestCSharp.cpp
index 91962ef..550f5b4 100644
--- a/clang/unittests/Format/FormatTestCSharp.cpp
+++ b/clang/unittests/Format/FormatTestCSharp.cpp
@@ -245,11 +245,13 @@ TEST_F(FormatTestCSharp, Attributes) {
"}");
verifyFormat("[TestMethod]\n"
- "public string Host { set; get; }");
+ "public string Host\n"
+ "{ set; get; }");
verifyFormat("[TestMethod(\"start\", HelpText = \"Starts the server "
"listening on provided host\")]\n"
- "public string Host { set; get; }");
+ "public string Host\n"
+ "{ set; get; }");
verifyFormat(
"[DllImport(\"Hello\", EntryPoint = \"hello_world\")]\n"
@@ -671,6 +673,32 @@ class MyClass {
DefaultThirdArgument);
})",
Style);
+
+ // Brace wrapping and single-lining of accessor can be controlled by config.
+ Style.AllowShortBlocksOnASingleLine = FormatStyle::SBS_Never;
+ Style.BreakBeforeBraces = FormatStyle::BS_Custom;
+ Style.BraceWrapping.AfterFunction = true;
+
+ verifyFormat(R"(//
+public class SaleItem {
+ public decimal Price
+ { get; set; }
+})",
+ Style);
+
+ verifyFormat(R"(//
+class TimePeriod {
+ public double Hours
+ {
+ get {
+ return _seconds / 3600;
+ }
+ set {
+ _seconds = value * 3600;
+ }
+ }
+})",
+ Style);
}
TEST_F(FormatTestCSharp, CSharpSpaces) {