Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
cd3d94f
initial change
CyrusNajmabadi Jul 23, 2025
a167ea9
Renames
CyrusNajmabadi Jul 23, 2025
c57c742
Update tests
CyrusNajmabadi Jul 23, 2025
d6905ae
Update tests
CyrusNajmabadi Jul 23, 2025
7fa31e8
Update tests
CyrusNajmabadi Jul 23, 2025
0c291fe
Update tests
CyrusNajmabadi Jul 23, 2025
3aa2251
Update tests
CyrusNajmabadi Jul 23, 2025
31b5443
Update tests
CyrusNajmabadi Jul 23, 2025
29528b5
Update tests
CyrusNajmabadi Jul 23, 2025
f185305
Update tests
CyrusNajmabadi Jul 23, 2025
27a03a6
Update tests
CyrusNajmabadi Jul 23, 2025
872ef8f
Update tests
CyrusNajmabadi Jul 23, 2025
324f41a
Update tests
CyrusNajmabadi Jul 23, 2025
70d63a7
Update tests
CyrusNajmabadi Jul 23, 2025
7eb530f
Update tests
CyrusNajmabadi Jul 23, 2025
27425f7
Update tests
CyrusNajmabadi Jul 23, 2025
c3d56c8
Update tests
CyrusNajmabadi Jul 23, 2025
2cf674b
Update tests
CyrusNajmabadi Jul 23, 2025
6d28994
Update tests
CyrusNajmabadi Jul 23, 2025
a782d97
Update tests
CyrusNajmabadi Jul 23, 2025
186259d
Update tests
CyrusNajmabadi Jul 23, 2025
b554e68
Update tests
CyrusNajmabadi Jul 23, 2025
ecbfdb6
Update tests
CyrusNajmabadi Jul 23, 2025
d92f4c2
Update tests
CyrusNajmabadi Jul 23, 2025
f212f77
Update tests
CyrusNajmabadi Jul 23, 2025
095995d
Update tests
CyrusNajmabadi Jul 23, 2025
b1951d2
Update tests
CyrusNajmabadi Jul 23, 2025
9f4befb
Update tests
CyrusNajmabadi Jul 23, 2025
2533bd1
Update tests
CyrusNajmabadi Jul 23, 2025
92f8d5b
Update tests
CyrusNajmabadi Jul 23, 2025
5aa6ac0
Update tests
CyrusNajmabadi Jul 23, 2025
2ab2270
Update tests
CyrusNajmabadi Jul 23, 2025
0870c68
Update tests
CyrusNajmabadi Jul 23, 2025
c7cc0fa
Update tests
CyrusNajmabadi Jul 23, 2025
2668de4
Update tests
CyrusNajmabadi Jul 23, 2025
52bbc89
Update tests
CyrusNajmabadi Jul 23, 2025
1cba585
Update tests
CyrusNajmabadi Jul 23, 2025
e6b2b41
Update tests
CyrusNajmabadi Jul 23, 2025
3d58494
Update tests
CyrusNajmabadi Jul 23, 2025
cb96198
Update tests
CyrusNajmabadi Jul 23, 2025
6cab13a
Update tests
CyrusNajmabadi Jul 23, 2025
289f6df
Update tests
CyrusNajmabadi Jul 23, 2025
75a20ae
Update tests
CyrusNajmabadi Jul 23, 2025
19d4f52
Update tests
CyrusNajmabadi Jul 23, 2025
ed7716e
Update tests
CyrusNajmabadi Jul 23, 2025
ace7474
Update tests
CyrusNajmabadi Jul 23, 2025
8f90eb7
Update tests
CyrusNajmabadi Jul 23, 2025
d98c5c9
Update tests
CyrusNajmabadi Jul 23, 2025
c7ad018
Update tests
CyrusNajmabadi Jul 23, 2025
c3f3be1
Update tests
CyrusNajmabadi Jul 23, 2025
ab828ff
Update tests
CyrusNajmabadi Jul 23, 2025
79ce4c9
Update tests
CyrusNajmabadi Jul 23, 2025
2564640
Update tests
CyrusNajmabadi Jul 23, 2025
7e87f81
Update tests
CyrusNajmabadi Jul 23, 2025
d00e047
Update tests
CyrusNajmabadi Jul 23, 2025
afb1347
Update tests
CyrusNajmabadi Jul 23, 2025
3871b9d
Update tests
CyrusNajmabadi Jul 23, 2025
ec7d61c
Update tests
CyrusNajmabadi Jul 23, 2025
e3da384
Update tests
CyrusNajmabadi Jul 23, 2025
cb2db07
Update tests
CyrusNajmabadi Jul 23, 2025
a3e419e
Update tests
CyrusNajmabadi Jul 23, 2025
bba4450
Update tests
CyrusNajmabadi Jul 23, 2025
ff7f18d
Update tests
CyrusNajmabadi Jul 23, 2025
7fc502f
Update tests
CyrusNajmabadi Jul 23, 2025
09fb4d8
Update tests
CyrusNajmabadi Jul 23, 2025
fd756c8
Update tests
CyrusNajmabadi Jul 23, 2025
fa0d060
Update tests
CyrusNajmabadi Jul 23, 2025
b459d91
Update tests
CyrusNajmabadi Jul 23, 2025
e8bd575
Update tests
CyrusNajmabadi Jul 23, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ class {|FixAllInContainingType:Program|}
internal class Program
{
}
""", TestParameters.Default.parseOptions);
""", new(TestParameters.Default.parseOptions));
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ internal override (DiagnosticAnalyzer?, CodeFixProvider) CreateDiagnosticProvide

[Fact]
public Task Test1()
=> TestInRegularAndScript1Async(
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we had to have this '1' in the name to prevent ambiguity collisions. Now the duplicative members are gone. so the naming ludge isn't needed.

=> TestInRegularAndScriptAsync(
"""
class C
{
Expand All @@ -48,7 +48,7 @@ void M()

[Fact]
public Task TestExistingName()
=> TestInRegularAndScript1Async(
=> TestInRegularAndScriptAsync(
"""
class C
{
Expand All @@ -70,7 +70,7 @@ void M()

[Fact]
public Task TestFixAll1()
=> TestInRegularAndScript1Async(
=> TestInRegularAndScriptAsync(
"""
class C
{
Expand All @@ -92,7 +92,7 @@ void M()

[Fact]
public Task TestFixAll2()
=> TestInRegularAndScript1Async(
=> TestInRegularAndScriptAsync(
"""
class C
{
Expand All @@ -114,7 +114,7 @@ void M()

[Fact]
public Task TestFixAll3()
=> TestInRegularAndScript1Async(
=> TestInRegularAndScriptAsync(
"""
class C
{
Expand Down
4 changes: 2 additions & 2 deletions src/Analyzers/CSharp/Tests/AddBraces/AddBracesTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1853,11 +1853,11 @@ private async Task TestAsync(string initialMarkup, string expectedMarkup, Prefer
{
if (expectDiagnostic)
{
await TestInRegularAndScriptAsync(initialMarkup, expectedMarkup, options: Option(CSharpCodeStyleOptions.PreferBraces, bracesPreference, NotificationOption2.Silent));
await TestInRegularAndScriptAsync(initialMarkup, expectedMarkup, new(options: Option(CSharpCodeStyleOptions.PreferBraces, bracesPreference, NotificationOption2.Silent)));
}
else
{
await TestMissingInRegularAndScriptAsync(initialMarkup, new TestParameters(options: Option(CSharpCodeStyleOptions.PreferBraces, bracesPreference, NotificationOption2.Silent)));
await TestMissingInRegularAndScriptAsync(initialMarkup, new(options: Option(CSharpCodeStyleOptions.PreferBraces, bracesPreference, NotificationOption2.Silent)));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2430,9 +2430,9 @@ public Test(string s, Base b, int i, params object[] list) : this(d : [||]b, s :
}
}
""";
using (var workspace = CreateWorkspaceFromOptions(initialMarkup, new TestParameters()))
using (var workspace = CreateWorkspaceFromOptions(initialMarkup, TestParameters.Default))
{
var (actions, actionToInvoke) = await GetCodeActionsAsync(workspace, new TestParameters());
var (actions, actionToInvoke) = await GetCodeActionsAsync(workspace, TestParameters.Default);
Assert.Equal(2, actions.Length);
}

Expand All @@ -2452,7 +2452,7 @@ public Test(string s, Base b, int i, params object[] list) : this(d : (Derived)b
}
}
""", index: 0,
title: string.Format(CodeFixesResources.Convert_type_to_0, "Derived"));
new(title: string.Format(CodeFixesResources.Convert_type_to_0, "Derived")));
await TestInRegularAndScriptAsync(initialMarkup, """
class Program
{
Expand All @@ -2469,7 +2469,7 @@ public Test(string s, Base b, int i, params object[] list) : this(d : (Derived2)
}
}
""", index: 1,
title: string.Format(CodeFixesResources.Convert_type_to_0, "Derived2"));
new(title: string.Format(CodeFixesResources.Convert_type_to_0, "Derived2")));
}

[Fact]
Expand All @@ -2493,9 +2493,9 @@ public Test(string s, Base b, int i, params object[] list) : this(d : [||]b, s :
}
""";

using (var workspace = CreateWorkspaceFromOptions(initialMarkup, new TestParameters()))
using (var workspace = CreateWorkspaceFromOptions(initialMarkup, TestParameters.Default))
{
var (actions, actionToInvoke) = await GetCodeActionsAsync(workspace, new TestParameters());
var (actions, actionToInvoke) = await GetCodeActionsAsync(workspace, TestParameters.Default);
Assert.Equal(2, actions.Length);
}

Expand All @@ -2515,7 +2515,7 @@ public Test(string s, Base b, int i, params object[] list) : this(d : (Derived)b
}
}
""", index: 0,
title: string.Format(CodeFixesResources.Convert_type_to_0, "Derived"));
new(title: string.Format(CodeFixesResources.Convert_type_to_0, "Derived")));
await TestInRegularAndScriptAsync(initialMarkup, """
class Program
{
Expand All @@ -2532,7 +2532,7 @@ public Test(string s, Base b, int i, params object[] list) : this(d : (Derived2)
}
}
""", index: 1,
title: string.Format(CodeFixesResources.Convert_type_to_0, "Derived2"));
new(title: string.Format(CodeFixesResources.Convert_type_to_0, "Derived2")));

}

Expand Down Expand Up @@ -2633,9 +2633,9 @@ void M()
}
}
""";
using (var workspace = CreateWorkspaceFromOptions(initialMarkup, new TestParameters()))
using (var workspace = CreateWorkspaceFromOptions(initialMarkup, TestParameters.Default))
{
var (actions, actionToInvoke) = await GetCodeActionsAsync(workspace, new TestParameters());
var (actions, actionToInvoke) = await GetCodeActionsAsync(workspace, TestParameters.Default);
Assert.Equal(2, actions.Length);
}

Expand All @@ -2658,7 +2658,7 @@ void M()
}
}
""", index: 0,
title: string.Format(CodeFixesResources.Convert_type_to_0, "Derived"));
new(title: string.Format(CodeFixesResources.Convert_type_to_0, "Derived")));
await TestInRegularAndScriptAsync(initialMarkup, """
class Program
{
Expand All @@ -2678,7 +2678,7 @@ void M()
}
}
""", index: 1,
title: string.Format(CodeFixesResources.Convert_type_to_0, "Derived2"));
new(title: string.Format(CodeFixesResources.Convert_type_to_0, "Derived2")));
}

[Fact]
Expand Down Expand Up @@ -2707,9 +2707,9 @@ void M()
}
}
""";
using (var workspace = CreateWorkspaceFromOptions(initialMarkup, new TestParameters()))
using (var workspace = CreateWorkspaceFromOptions(initialMarkup, TestParameters.Default))
{
var (actions, actionToInvoke) = await GetCodeActionsAsync(workspace, new TestParameters());
var (actions, actionToInvoke) = await GetCodeActionsAsync(workspace, TestParameters.Default);
Assert.Equal(3, actions.Length);
}

Expand All @@ -2735,7 +2735,7 @@ void M()
}
}
""", index: 0,
title: string.Format(CodeFixesResources.Convert_type_to_0, "string"));
new(title: string.Format(CodeFixesResources.Convert_type_to_0, "string")));
await TestInRegularAndScriptAsync(initialMarkup, """
class Program
{
Expand All @@ -2758,7 +2758,7 @@ void M()
}
}
""", index: 1,
title: string.Format(CodeFixesResources.Convert_type_to_0, "Derived"));
new(title: string.Format(CodeFixesResources.Convert_type_to_0, "Derived")));
await TestInRegularAndScriptAsync(initialMarkup, """
class Program
{
Expand All @@ -2781,7 +2781,7 @@ void M()
}
}
""", index: 2,
title: string.Format(CodeFixesResources.Convert_type_to_0, "Derived2"));
new(title: string.Format(CodeFixesResources.Convert_type_to_0, "Derived2")));
}

[Fact]
Expand Down
38 changes: 19 additions & 19 deletions src/Analyzers/CSharp/Tests/AddParameter/AddParameterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2477,7 +2477,7 @@ void local(int x, int y)
void local(int x, int y, int v)
{
}
""", parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp9));
""", new(parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp9)));

[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/44271")]
public Task TopLevelStatement_Nested()
Expand Down Expand Up @@ -2579,7 +2579,7 @@ namespace System.Runtime.CompilerServices
{
public static class IsExternalInit { }
}
""", parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp9));
""", new(parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp9)));

[Fact]
public Task Test_PrimaryConstructor_Class()
Expand All @@ -2593,7 +2593,7 @@ class R(int A);
var r = new R(1, b);

class R(int A, string b);
""", parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp12));
""", new(parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp12)));

[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/54408")]
public Task TestPositionalRecordStruct()
Expand All @@ -2617,7 +2617,7 @@ namespace System.Runtime.CompilerServices
{
public static class IsExternalInit { }
}
""", parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp9));
""", new(parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp9)));

[Fact]
public Task Test_PrimaryConstructor_Struct()
Expand All @@ -2631,11 +2631,11 @@ struct R(int A);
var r = new R(1, b);

struct R(int A, string b);
""", parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp12));
""", new(parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp12)));

[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/56952")]
public Task TestRecordsNamingConventions()
=> TestInRegularAndScript1Async("""
=> TestInRegularAndScriptAsync("""
[|new Test("repro")|];

record Test();
Expand All @@ -2649,7 +2649,7 @@ record Test(string V);

[Fact]
public Task TestNamingConventions_PrimaryConstructor_Class()
=> TestInRegularAndScript1Async("""
=> TestInRegularAndScriptAsync("""
[|new Test("repro")|];

class Test();
Expand All @@ -2661,7 +2661,7 @@ class Test(string v);

[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/56952")]
public Task TestRecordsNamingConventions_RecordStruct()
=> TestInRegularAndScript1Async("""
=> TestInRegularAndScriptAsync("""
[|new Test("repro")|];

record struct Test();
Expand All @@ -2675,7 +2675,7 @@ record struct Test(string V);

[Fact]
public Task TestNamingConventions_PrimaryConstructor_Struct()
=> TestInRegularAndScript1Async("""
=> TestInRegularAndScriptAsync("""
[|new Test("repro")|];

struct Test();
Expand All @@ -2687,7 +2687,7 @@ struct Test(string v);

[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/61715")]
public Task TestMethodGroup1()
=> TestInRegularAndScript1Async("""
=> TestInRegularAndScriptAsync("""
public class Example
{
public void Add(int x)
Expand Down Expand Up @@ -2723,7 +2723,7 @@ public void Main()

[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/61715")]
public Task TestMethodGroup2()
=> TestInRegularAndScript1Async("""
=> TestInRegularAndScriptAsync("""
public class Example
{
public void Add(int x, string y)
Expand Down Expand Up @@ -2759,7 +2759,7 @@ public void Main()

[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/61715")]
public Task TestMethodGroup3()
=> TestInRegularAndScript1Async("""
=> TestInRegularAndScriptAsync("""
public class Example
{
public int Add(int x, string y)
Expand Down Expand Up @@ -2797,7 +2797,7 @@ public void Main()

[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/71428")]
public Task TestAddConstructorParameterWithExistingField_BlockInitialize()
=> TestInRegularAndScript1Async(
=> TestInRegularAndScriptAsync(
"""
class C
{
Expand Down Expand Up @@ -2846,7 +2846,7 @@ void M(string t)

[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/71428")]
public Task TestAddConstructorParameterWithExistingField_ExpressionBodyInitialize()
=> TestInRegularAndScript1Async(
=> TestInRegularAndScriptAsync(
"""
class C
{
Expand Down Expand Up @@ -2889,7 +2889,7 @@ void M(string t)

[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/71428")]
public Task TestAddConstructorParameterWithExistingField_TupleInitialize()
=> TestInRegularAndScript1Async(
=> TestInRegularAndScriptAsync(
"""
class C
{
Expand Down Expand Up @@ -2935,7 +2935,7 @@ void M(string i)

[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/71428")]
public Task TestAddConstructorParameterWithExistingField_UnderscoreName()
=> TestInRegularAndScript1Async(
=> TestInRegularAndScriptAsync(
"""
class C
{
Expand Down Expand Up @@ -2976,7 +2976,7 @@ void M(string s)

[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/71428")]
public Task TestAddConstructorParameterWithExistingField_PrimaryConstructor()
=> TestInRegularAndScript1Async(
=> TestInRegularAndScriptAsync(
"""
class C()
{
Expand Down Expand Up @@ -3008,7 +3008,7 @@ void M(string name)

[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/71428")]
public Task TestAddConstructorParameterWithExistingProperty_PrimaryConstructor()
=> TestInRegularAndScript1Async(
=> TestInRegularAndScriptAsync(
"""
class C()
{
Expand Down Expand Up @@ -3040,7 +3040,7 @@ void M(string name)

[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/71428")]
public Task TestAddConstructorParameterWithExistingThrowingProperty_PrimaryConstructor()
=> TestInRegularAndScript1Async(
=> TestInRegularAndScriptAsync(
"""
using System;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ private Task TestMissingAsync(string initialMarkup, OptionsCollection options)
=> TestMissingInRegularAndScriptAsync(initialMarkup, new TestParameters(options: options));

private Task TestAsync(string initialMarkup, string expected, OptionsCollection options)
=> TestInRegularAndScript1Async(initialMarkup, expected, parameters: new TestParameters(options: options));
=> TestInRegularAndScriptAsync(initialMarkup, expected, parameters: new TestParameters(options: options));

[Fact]
public Task TestArithmeticPrecedence()
Expand Down Expand Up @@ -732,7 +732,7 @@ void M()
}
}
}
""", options: RequireAllParenthesesForClarity);
""", new(options: RequireAllParenthesesForClarity));

[Fact]
public Task TestFixAll3()
Expand Down Expand Up @@ -769,5 +769,5 @@ void M()
int x = 1 + (2 * 3) == 1 + (2 * 3);
}
}
""", options: RequireAllParenthesesForClarity);
""", new(options: RequireAllParenthesesForClarity));
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ private Task TestMissingAsync(string initialMarkup, OptionsCollection options)
=> TestMissingInRegularAndScriptAsync(initialMarkup, new TestParameters(options: options));

private Task TestAsync(string initialMarkup, string expected, OptionsCollection options)
=> TestInRegularAndScript1Async(initialMarkup, expected, parameters: new TestParameters(options: options));
=> TestInRegularAndScriptAsync(initialMarkup, expected, parameters: new TestParameters(options: options));

[Fact]
public Task TestLogicalPrecedence()
Expand Down
Loading
Loading