diff options
Diffstat (limited to 'clang/unittests/Format/FormatTestCSharp.cpp')
-rw-r--r-- | clang/unittests/Format/FormatTestCSharp.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTestCSharp.cpp b/clang/unittests/Format/FormatTestCSharp.cpp index 26c62c1..2a76420 100644 --- a/clang/unittests/Format/FormatTestCSharp.cpp +++ b/clang/unittests/Format/FormatTestCSharp.cpp @@ -960,9 +960,11 @@ TEST_F(FormatTestCSharp, CSharpPropertyAccessors) { verifyFormat("int Value { get; } = 0", Style); verifyFormat("int Value { set }", Style); verifyFormat("int Value { set; }", Style); + verifyFormat("int Value { init; }", Style); verifyFormat("int Value { internal set; }", Style); verifyFormat("int Value { set; } = 0", Style); verifyFormat("int Value { get; set }", Style); + verifyFormat("int Value { get; init; }", Style); verifyFormat("int Value { set; get }", Style); verifyFormat("int Value { get; private set; }", Style); verifyFormat("int Value { get; set; }", Style); @@ -976,6 +978,18 @@ public string Name { set => _name = value; })", Style); + verifyFormat(R"(// +public string Name { + init => _name = value; + get => _name; +})", + Style); + verifyFormat(R"(// +public string Name { + set => _name = value; + get => _name; +})", + Style); // Examples taken from // https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/properties |