Changeset View
Changeset View
Standalone View
Standalone View
clang/unittests/Format/FormatTestCSharp.cpp
Show First 20 Lines • Show All 610 Lines • ▼ Show 20 Lines | var x = foo(className, $@"some code: | ||||
// Interpolated string with embedded multiline string. | // Interpolated string with embedded multiline string. | ||||
Code = R"(Console.WriteLine($"{string.Join(@", | Code = R"(Console.WriteLine($"{string.Join(@", | ||||
", values)}");)"; | ", values)}");)"; | ||||
EXPECT_EQ(Code, format(Code, Style)); | 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) { | TEST_F(FormatTestCSharp, CSharpLambdas) { | ||||
FormatStyle GoogleStyle = getGoogleStyle(FormatStyle::LK_CSharp); | FormatStyle GoogleStyle = getGoogleStyle(FormatStyle::LK_CSharp); | ||||
FormatStyle MicrosoftStyle = getMicrosoftStyle(FormatStyle::LK_CSharp); | FormatStyle MicrosoftStyle = getMicrosoftStyle(FormatStyle::LK_CSharp); | ||||
verifyFormat(R"(// | verifyFormat(R"(// | ||||
class MyClass { | class MyClass { | ||||
Action<string> greet = name => { | Action<string> greet = name => { | ||||
string greeting = $"Hello {name}!"; | string greeting = $"Hello {name}!"; | ||||
▲ Show 20 Lines • Show All 957 Lines • Show Last 20 Lines |