提交 aac69302 编写于 作者: G Gen Lu

Add codefix tests

上级 a4d887aa
......@@ -342,6 +342,70 @@ static int AddLocal(int a = 0, int b = 0, int x = 0, string y = null)
}"
, parseOptions: CSharp8ParseOptions);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsMakeLocalFunctionStatic)]
public async Task TestWarningAnnotation()
{
await TestInRegularAndScriptAsync(
@"class C
{
void N(int x)
{
Func<int> del = AddLocal;
static int AddLocal()
{
return [||]x + 1;
}
}
}",
@"class C
{
void N(int x)
{
Func<int> del = AddLocal;
{|Warning:static int AddLocal(int x)
{
return x + 1;
}|}
}
}",
parseOptions: CSharp8ParseOptions);
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsMakeLocalFunctionStatic)]
public async Task TestNonCamelCaseCapture()
{
await TestInRegularAndScriptAsync(
@"class C
{
int N(int x)
{
int Static = 0;
return AddLocal();
static int AddLocal()
{
return [||]Static + 1;
}
}
}",
@"class C
{
int N(int x)
{
int Static = 0;
return AddLocal(Static);
static int AddLocal(int @static)
{
return @static + 1;
}
}
}",
parseOptions: CSharp8ParseOptions);
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册