Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make tests consistent #73316

Merged
merged 2 commits into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -122,8 +122,7 @@ class Program
""");
}

[Theory]
[CombinatorialData]
[Theory, CombinatorialData]
public async Task TestRedundantRestoreDiffersFromPriorContext(NullableContextOptions compilationContext)
{
var enable = compilationContext != NullableContextOptions.Enable;
Expand All @@ -146,8 +145,7 @@ class Program
""");
}

[Theory]
[CombinatorialData]
[Theory, CombinatorialData]
public async Task TestRedundantRestoreMatchesCompilation(NullableContextOptions compilationContext)
{
await VerifyCodeFixAsync(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2180,8 +2180,7 @@ class MyClass
""");
}

[Theory]
[CombinatorialData]
[Theory, CombinatorialData]
public async Task MultipleFields_AllUnused_FixOne(
[CombinatorialValues("[|_goo|]", "[|_goo|] = 0")] string firstField,
[CombinatorialValues("[|_bar|]", "[|_bar|] = 2")] string secondField,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -496,8 +496,7 @@ int M(int {|IDE0060:p|})
}.RunAsync();
}

[Theory]
[CombinatorialData]
[Theory, CombinatorialData]
public async Task Initialization_NonConstantValue_LocalReference(
[CombinatorialValues(UnusedValuePreference.DiscardVariable, UnusedValuePreference.UnusedLocalVariable)] object option,
[CombinatorialValues(CodeFixTestBehaviors.None, CodeFixTestBehaviors.FixOne)] CodeFixTestBehaviors testBehaviors)
Expand Down Expand Up @@ -557,8 +556,7 @@ int M()
}.RunAsync();
}

[Theory]
[CombinatorialData]
[Theory, CombinatorialData]
public async Task Assignment_NonConstantValue_LocalReference(
[CombinatorialValues(UnusedValuePreference.DiscardVariable, UnusedValuePreference.UnusedLocalVariable)] object option,
[CombinatorialValues(CodeFixTestBehaviors.None, CodeFixTestBehaviors.FixOne)] CodeFixTestBehaviors testBehaviors)
Expand Down Expand Up @@ -1115,8 +1113,7 @@ public static explicit operator C(int {|IDE0060:i|})
}.RunAsync();
}

[Theory]
[CombinatorialData]
[Theory, CombinatorialData]
public async Task NestedAssignment_ConstantValue(
[CombinatorialValues(UnusedValuePreference.DiscardVariable, UnusedValuePreference.UnusedLocalVariable)] object option,
[CombinatorialValues(CodeFixTestBehaviors.None, CodeFixTestBehaviors.FixOne | CodeFixTestBehaviors.SkipFixAllCheck)] CodeFixTestBehaviors testBehaviors)
Expand Down Expand Up @@ -1195,8 +1192,7 @@ int M(int {|IDE0060:x|}, int {|IDE0060:y|})
await test.RunAsync();
}

[Theory]
[CombinatorialData]
[Theory, CombinatorialData]
public async Task NestedAssignment_NonConstantValue(
[CombinatorialValues(UnusedValuePreference.DiscardVariable, UnusedValuePreference.UnusedLocalVariable)] object option,
[CombinatorialValues(CodeFixTestBehaviors.None, CodeFixTestBehaviors.FixOne | CodeFixTestBehaviors.SkipFixAllCheck)] CodeFixTestBehaviors testBehaviors)
Expand Down Expand Up @@ -1329,8 +1325,7 @@ int M()
}.RunAsync();
}

[Theory]
[CombinatorialData]
[Theory, CombinatorialData]
public async Task IncrementOrDecrementOperator_ValueUsed_SameStatement(
[CombinatorialValues("++", "--")] string @operator,
bool applyAsPrefix,
Expand Down Expand Up @@ -1384,8 +1379,7 @@ void M(int x)
await test.RunAsync();
}

[Theory]
[CombinatorialData]
[Theory, CombinatorialData]
public async Task IncrementOrDecrementOperator_ValueUsed_LaterStatement(
[CombinatorialValues("++", "--")] string @operator,
bool applyAsPrefix,
Expand Down Expand Up @@ -1415,8 +1409,7 @@ int M(int x)
}.RunAsync();
}

[Theory]
[CombinatorialData]
[Theory, CombinatorialData]
public async Task IncrementOrDecrementOperator_ValueUnused(
[CombinatorialValues("++", "--")] string @operator,
bool applyAsPrefix,
Expand Down Expand Up @@ -1454,8 +1447,7 @@ void M(int {|IDE0060:x|})
}.RunAsync();
}

[Theory]
[CombinatorialData]
[Theory, CombinatorialData]
public async Task CompoundAssignmentOperator_ValueUsed_SameStatement(
[CombinatorialValues("1" /*Constant*/, "M2()" /*Non-constant*/)] string rightHandSide,
[CombinatorialValues(UnusedValuePreference.DiscardVariable, UnusedValuePreference.UnusedLocalVariable)] object option)
Expand Down Expand Up @@ -1511,8 +1503,7 @@ void M(int x)
await test.RunAsync();
}

[Theory]
[CombinatorialData]
[Theory, CombinatorialData]
public async Task CompoundAssignmentOperator_ValueUsed_LaterStatement(
[CombinatorialValues("1" /*Constant*/, "M2()" /*Non-constant*/)] string rightHandSide,
[CombinatorialValues(UnusedValuePreference.DiscardVariable, UnusedValuePreference.UnusedLocalVariable)] object option)
Expand Down Expand Up @@ -1542,8 +1533,7 @@ int M(int x)
}.RunAsync();
}

[Theory]
[CombinatorialData]
[Theory, CombinatorialData]
public async Task CompoundLogicalOrOperator_ValueUsed_LaterStatement(
[CombinatorialValues("true" /*Constant*/, "M2()" /*Non-constant*/)] string rightHandSide,
[CombinatorialValues(UnusedValuePreference.DiscardVariable, UnusedValuePreference.UnusedLocalVariable)] object option)
Expand Down Expand Up @@ -1573,8 +1563,7 @@ bool M(bool x)
}.RunAsync();
}

[Theory]
[CombinatorialData]
[Theory, CombinatorialData]
public async Task CompoundLogicalOrOperator_ValueUsed_LaterStatement_02(
[CombinatorialValues("true" /*Constant*/, "M2()" /*Non-constant*/)] string rightHandSide,
[CombinatorialValues(UnusedValuePreference.DiscardVariable, UnusedValuePreference.UnusedLocalVariable)] object option)
Expand Down Expand Up @@ -2781,8 +2770,7 @@ void M(object p)
""", options: PreferDiscard, parseOptions: new CSharpParseOptions(LanguageVersion.CSharp9));
}

[Theory]
[CombinatorialData]
[Theory, CombinatorialData]
public async Task DeclarationPatternInSwitchCase_WithOnlyWriteReference_PreferUnusedLocal(
[CombinatorialValues(LanguageVersion.CSharp8, LanguageVersion.CSharp9)] LanguageVersion languageVersion)
{
Expand All @@ -2803,8 +2791,7 @@ void M(object p)
""", new TestParameters(options: PreferUnusedLocal, parseOptions: new CSharpParseOptions(languageVersion)));
}

[Theory]
[CombinatorialData]
[Theory, CombinatorialData]
public async Task DeclarationPatternInSwitchCase_WithOnlyWriteReference_TypePattern(
[CombinatorialValues(CodeFixTestBehaviors.None, CodeFixTestBehaviors.FixOne)] CodeFixTestBehaviors testBehaviors)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6374,8 +6374,7 @@ static void Main(string[] args)
/// Note that this test verifies the current end of line sequence in using directives is preserved regardless of
/// whether this matches the end_of_line value in .editorconfig or not.
/// </summary>
[Theory]
[CombinatorialData]
[Theory, CombinatorialData]
[WorkItem("https://github.com/dotnet/roslyn/issues/62976")]
public async Task TestAddUsingPreservesNewlines1(TestHost testHost, [CombinatorialValues("\n", "\r\n")] string sourceNewLine, [CombinatorialValues("\n", "\r\n")] string configuredNewLine)
{
Expand Down Expand Up @@ -6418,8 +6417,7 @@ class Class
/// Note that this test verifies the current end of line sequence in using directives is preserved regardless of
/// whether this matches the end_of_line value in .editorconfig or not.
/// </summary>
[Theory]
[CombinatorialData]
[Theory, CombinatorialData]
[WorkItem("https://github.com/dotnet/roslyn/issues/62976")]
public async Task TestAddUsingPreservesNewlines2(TestHost testHost, [CombinatorialValues("\n", "\r\n")] string sourceNewLine, [CombinatorialValues("\n", "\r\n")] string configuredNewLine)
{
Expand Down Expand Up @@ -6473,8 +6471,7 @@ class Class
parameters: new TestParameters(options: Option(FormattingOptions2.NewLine, configuredNewLine), testHost: testHost));
}

[Theory]
[CombinatorialData]
[Theory, CombinatorialData]
[WorkItem("https://github.com/dotnet/roslyn/issues/62976")]
public async Task TestAddUsingPreservesNewlines3(TestHost testHost, [CombinatorialValues("\n", "\r\n")] string sourceNewLine, [CombinatorialValues("\n", "\r\n")] string configuredNewLine)
{
Expand Down Expand Up @@ -6528,8 +6525,7 @@ class Class
parameters: new TestParameters(options: Option(FormattingOptions2.NewLine, configuredNewLine), testHost: testHost));
}

[Theory]
[CombinatorialData]
[Theory, CombinatorialData]
[WorkItem("https://github.com/dotnet/roslyn/issues/24642")]
public async Task TestAddUsingWithMalformedGeneric(TestHost testHost)
{
Expand All @@ -6552,8 +6548,7 @@ class Class
parameters: new TestParameters(testHost: testHost));
}

[Theory]
[CombinatorialData]
[Theory, CombinatorialData]
public async Task TestOutsideOfMethodWithMalformedGenericParameters(TestHost testHost)
{
await TestInRegularAndScript1Async(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1107,8 +1107,7 @@ public static void Deconstruct(this Program p, out int x, out int y) { }
parseOptions: null);
}

[Theory]
[CombinatorialData]
[Theory, CombinatorialData]
[WorkItem("https://github.com/dotnet/roslyn/issues/16547")]
public async Task TestAddUsingForAddExtensionMethodWithSameNameAsProperty(TestHost testHost)
{
Expand Down Expand Up @@ -1171,8 +1170,7 @@ public static Foo Self(this Foo foo)
}", testHost);
}

[Theory]
[CombinatorialData]
[Theory, CombinatorialData]
[WorkItem("https://github.com/dotnet/roslyn/issues/39155")]
public async Task TestExtensionGetAwaiterOverload(TestHost testHost)
{
Expand Down Expand Up @@ -1262,8 +1260,7 @@ public void GetResult()
", testHost);
}

[Theory]
[CombinatorialData]
[Theory, CombinatorialData]
[WorkItem("https://github.com/dotnet/roslyn/issues/39155")]
public async Task TestExtensionSelectOverload(TestHost testHost)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.AddUsing
[Trait(Traits.Feature, Traits.Features.CodeActionsAddImport)]
public partial class AddUsingTests_Razor : AbstractAddUsingTests
{
[Theory]
[CombinatorialData]
[Theory, CombinatorialData]
public async Task TestAddIntoHiddenRegionWithModernSpanMapper(TestHost host)
{
await TestAsync(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ void Target({type} arg)
await VerifyDefaultValueAsync(markup, expectedDefaultValue: null, previousDefaultValue: "prior");
}

[Theory]
[CombinatorialData]
[Theory, CombinatorialData]
public async Task TestOutVariable(
[CombinatorialValues("string", "bool", "int?")] string type,
[CombinatorialValues("out", "ref", "in")] string modifier)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ namespace Microsoft.CodeAnalysis.CSharp.EditAndContinue.UnitTests
[UseExportProvider]
public class ActiveStatementTrackingServiceTests
{
[Theory]
[CombinatorialData]
[Theory, CombinatorialData]
public async Task TrackingService_GetLatestSpansAsync(bool scheduleInitialTrackingBeforeOpenDoc)
{
var source1 = "class C { void F() => G(1); void G(int a) => System.Console.WriteLine(1); }";
Expand Down
Loading
Loading