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

Update Roslyn Testing SDK #66681

Merged
merged 2 commits into from
Mar 16, 2022
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
2 changes: 1 addition & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@
<MoqVersion>4.12.0</MoqVersion>
<FsCheckVersion>2.14.3</FsCheckVersion>
<SdkVersionForWorkloadTesting>7.0.100-preview.3.22151.18</SdkVersionForWorkloadTesting>
<CompilerPlatformTestingVersion>1.1.1-beta1.22103.1</CompilerPlatformTestingVersion>
<CompilerPlatformTestingVersion>1.1.2-beta1.22122.4</CompilerPlatformTestingVersion>
<!-- Docs -->
<MicrosoftPrivateIntellisenseVersion>6.0.0-preview-20220104.1</MicrosoftPrivateIntellisenseVersion>
<!-- ILLink -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace LibraryImportGenerator.UnitTests
{
public class AdditionalAttributesOnStub
{
[ConditionalFact]
[Fact]
public async Task SkipLocalsInitAdded()
{
string source = @"
Expand Down Expand Up @@ -45,7 +45,7 @@ public Native(S s) { }
Assert.Contains(stubMethod.GetAttributes(), attr => attr.AttributeClass!.ToDisplayString() == typeof(SkipLocalsInitAttribute).FullName);
}

[ConditionalFact]
[Fact]
public async Task SkipLocalsInitNotAddedOnForwardingStub()
{
string source = @"
Expand All @@ -64,7 +64,7 @@ partial class C
Assert.DoesNotContain(stubMethod.GetAttributes(), attr => attr.AttributeClass!.ToDisplayString() == typeof(SkipLocalsInitAttribute).FullName);
}

[ConditionalFact]
[Fact]
public async Task GeneratedCodeAdded()
{
string source = @"
Expand Down Expand Up @@ -96,7 +96,7 @@ public Native(S s) { }
Assert.Contains(stubMethod.GetAttributes(), attr => attr.AttributeClass!.ToDisplayString() == typeof(System.CodeDom.Compiler.GeneratedCodeAttribute).FullName);
}

[ConditionalFact]
[Fact]
public async Task GeneratedCodeNotAddedOnForwardingStub()
{
string source = @"
Expand Down Expand Up @@ -125,7 +125,7 @@ public static IEnumerable<object[]> GetDownlevelTargetFrameworks()
yield return new object[] { TestTargetFramework.Framework, false };
}

[ConditionalTheory]
[Theory]
[MemberData(nameof(GetDownlevelTargetFrameworks))]
public async Task SkipLocalsInitOnDownlevelTargetFrameworks(TestTargetFramework targetFramework, bool expectSkipLocalsInit)
{
Expand Down Expand Up @@ -154,7 +154,7 @@ partial class C
}
}

[ConditionalFact]
[Fact]
public async Task SkipLocalsInitNotAddedWhenDefinedAtModuleLevel()
{
string source = @"
Expand Down Expand Up @@ -186,7 +186,7 @@ public Native(S s) { }
Assert.DoesNotContain(stubMethod.GetAttributes(), attr => attr.AttributeClass!.ToDisplayString() == typeof(SkipLocalsInitAttribute).FullName);
}

[ConditionalFact]
[Fact]
public async Task SkipLocalsInitNotAddedWhenDefinedAtClassLevel()
{
string source = @"
Expand Down Expand Up @@ -218,7 +218,7 @@ public Native(S s) { }
Assert.DoesNotContain(stubMethod.GetAttributes(), attr => attr.AttributeClass!.ToDisplayString() == typeof(SkipLocalsInitAttribute).FullName);
}

[ConditionalFact]
[Fact]
public async Task SkipLocalsInitNotAddedWhenDefinedOnMethodByUser()
{
string source = @"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace LibraryImportGenerator.UnitTests
{
public class AttributeForwarding
{
[ConditionalTheory]
[Theory]
[InlineData("SuppressGCTransition", "System.Runtime.InteropServices.SuppressGCTransitionAttribute")]
[InlineData("UnmanagedCallConv", "System.Runtime.InteropServices.UnmanagedCallConvAttribute")]
public async Task KnownParameterlessAttribute(string attributeSourceName, string attributeMetadataName)
Expand Down Expand Up @@ -59,7 +59,7 @@ public Native(S s) {{ }}
attr => SymbolEqualityComparer.Default.Equals(attr.AttributeClass, attributeType));
}

[ConditionalFact]
[Fact]
public async Task UnmanagedCallConvAttribute_EmptyCallConvArray()
{
string source = @"
Expand Down Expand Up @@ -103,7 +103,7 @@ public Native(S s) { }
&& attr.NamedArguments[0].Value.Values.Length == 0);
}

[ConditionalFact]
[Fact]
public async Task UnmanagedCallConvAttribute_SingleCallConvType()
{
string source = @"
Expand Down Expand Up @@ -150,7 +150,7 @@ public Native(S s) { }
callConvType));
}

[ConditionalFact]
[Fact]
public async Task UnmanagedCallConvAttribute_MultipleCallConvTypes()
{
string source = @"
Expand Down Expand Up @@ -201,7 +201,7 @@ public Native(S s) { }
callConvType2));
}

[ConditionalFact]
[Fact]
public async Task DefaultDllImportSearchPathsAttribute()
{
string source = @$"
Expand Down Expand Up @@ -245,7 +245,7 @@ public Native(S s) {{ }}
&& expected == (DllImportSearchPath)attr.ConstructorArguments[0].Value!);
}

[ConditionalFact]
[Fact]
public async Task OtherAttributeType()
{
string source = @"
Expand Down Expand Up @@ -290,7 +290,7 @@ public Native(S s) { }
attr => SymbolEqualityComparer.Default.Equals(attr.AttributeClass, attributeType));
}

[ConditionalFact]
[Fact]
public async Task InOutAttributes_Forwarded_To_ForwardedParameter()
{
string source = @"
Expand Down Expand Up @@ -333,7 +333,7 @@ partial class C
}));
}

[ConditionalFact]
[Fact]
public async Task MarshalAsAttribute_Forwarded_To_ForwardedParameter()
{
string source = @"
Expand Down Expand Up @@ -362,7 +362,7 @@ partial class C
}));
}

[ConditionalFact]
[Fact]
public async Task MarshalAsAttribute_Forwarded_To_ForwardedParameter_Array()
{
string source = @"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public static IEnumerable<object[]> CodeSnippetsToCompile()
yield return new object[] { CodeSnippets.RefReturn("int"), 2, 2 };
}

[ConditionalTheory]
[Theory]
[MemberData(nameof(CodeSnippetsToCompile))]
public async Task ValidateSnippets(string source, int expectedGeneratorErrors, int expectedCompilerErrors)
{
Expand Down Expand Up @@ -153,7 +153,7 @@ public static IEnumerable<object[]> CodeSnippetsToCompile_InvalidCode()
yield return new object[] { CodeSnippets.IncorrectAttributeFieldType, 1, 1 };
}

[ConditionalTheory]
[Theory]
[MemberData(nameof(CodeSnippetsToCompile_InvalidCode))]
public async Task ValidateSnippets_InvalidCodeGracefulFailure(string source, int expectedGeneratorErrors, int expectedCompilerErrors)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ public static IEnumerable<object[]> CodeSnippetsToCompile()
yield return new[] { CodeSnippets.CollectionsOfCollectionsStress };
}

[ConditionalTheory]
[Theory]
[MemberData(nameof(CodeSnippetsToCompile))]
public async Task ValidateSnippets(string source)
{
Expand All @@ -257,7 +257,7 @@ public static IEnumerable<object[]> CodeSnippetsToCompileWithPreprocessorSymbols
yield return new object[] { CodeSnippets.PreprocessorIfAfterAttributeAroundFunctionAdditionalFunctionAfter("Foo"), Array.Empty<string>() };
}

[ConditionalTheory]
[Theory]
[MemberData(nameof(CodeSnippetsToCompileWithPreprocessorSymbols))]
public async Task ValidateSnippetsWithPreprocessorDefintions(string source, IEnumerable<string> preprocessorSymbols)
{
Expand Down Expand Up @@ -303,7 +303,7 @@ public static IEnumerable<object[]> CodeSnippetsToValidateFallbackForwarder()
}
}

[ConditionalTheory]
[Theory]
[MemberData(nameof(CodeSnippetsToValidateFallbackForwarder))]
public async Task ValidateSnippetsFallbackForwarder(string source, TestTargetFramework targetFramework, bool expectFallbackForwarder)
{
Expand Down Expand Up @@ -340,7 +340,7 @@ public static IEnumerable<object[]> FullyBlittableSnippetsToCompile()
yield return new[] { CodeSnippets.BasicParameterByValue("int") };
}

[ConditionalTheory]
[Theory]
[MemberData(nameof(FullyBlittableSnippetsToCompile))]
public async Task ValidateSnippetsWithBlittableAutoForwarding(string source)
{
Expand Down Expand Up @@ -374,7 +374,7 @@ public static IEnumerable<object[]> SnippetsWithBlittableTypesButNonBlittableDat
yield return new[] { CodeSnippets.SetLastErrorTrue<int>() };
}

[ConditionalTheory]
[Theory]
[MemberData(nameof(SnippetsWithBlittableTypesButNonBlittableDataToCompile))]
public async Task ValidateSnippetsWithBlittableTypesButNonBlittableMetadataDoNotAutoForward(string source)
{
Expand Down Expand Up @@ -412,7 +412,7 @@ public static IEnumerable<object[]> CodeSnippetsToCompileWithMarshalType()
#pragma warning disable xUnit1004 // Test methods should not be skipped.
// If we have any new experimental APIs that we are implementing that have not been approved,
// we will add new scenarios for this test.
[ConditionalTheory(Skip = "No current scenarios to test.")]
[Theory(Skip = "No current scenarios to test.")]
#pragma warning restore
[MemberData(nameof(CodeSnippetsToCompileWithMarshalType))]
public async Task ValidateSnippetsWithMarshalType(string source)
Expand Down Expand Up @@ -444,7 +444,7 @@ public static IEnumerable<object[]> CodeSnippetsToCompileMultipleSources()
yield return new object[] { new[] { CodeSnippets.BasicParameterByValue("int[]", CodeSnippets.DisableRuntimeMarshalling), CodeSnippets.BasicParameterWithByRefModifier("ref", "int") } };
}

[ConditionalTheory]
[Theory]
[MemberData(nameof(CodeSnippetsToCompileMultipleSources))]
public async Task ValidateSnippetsWithMultipleSources(string[] sources)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public static IEnumerable<object[]> UnsupportedTypes() => new[]
new object[] { typeof(System.Text.StringBuilder) },
};

[ConditionalTheory]
[Theory]
[MemberData(nameof(MarshallingRequiredTypes))]
[MemberData(nameof(NoMarshallingRequiredTypes))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/60909", typeof(PlatformDetection), nameof(PlatformDetection.IsArm64Process), nameof(PlatformDetection.IsWindows))]
Expand All @@ -64,7 +64,7 @@ await VerifyCS.VerifyAnalyzerAsync(
.WithArguments("Method_Return"));
}

[ConditionalTheory]
[Theory]
[MemberData(nameof(MarshallingRequiredTypes))]
[MemberData(nameof(NoMarshallingRequiredTypes))]
public async Task ByRef_ReportsDiagnostic(Type type)
Expand Down Expand Up @@ -97,7 +97,7 @@ await VerifyCS.VerifyAnalyzerAsync(
.WithArguments("Method_Ref"));
}

[ConditionalFact]
[Fact]
public async Task SetLastErrorTrue_ReportsDiagnostic()
{
string source = @$"
Expand All @@ -121,15 +121,15 @@ await VerifyCS.VerifyAnalyzerAsync(
.WithArguments("Method2"));
}

[ConditionalTheory]
[Theory]
[MemberData(nameof(UnsupportedTypes))]
public async Task UnsupportedType_NoDiagnostic(Type type)
{
string source = DllImportWithType(type.FullName!);
await VerifyCS.VerifyAnalyzerAsync(source);
}

[ConditionalTheory]
[Theory]
[InlineData(UnmanagedType.Interface)]
[InlineData(UnmanagedType.IDispatch)]
[InlineData(UnmanagedType.IInspectable)]
Expand All @@ -152,7 +152,7 @@ unsafe partial class Test
await VerifyCS.VerifyAnalyzerAsync(source);
}

[ConditionalFact]
[Fact]
public async Task LibraryImport_NoDiagnostic()
{
string source = @$"
Expand All @@ -171,7 +171,7 @@ partial class Test
await VerifyCS.VerifyAnalyzerAsync(source);
}

[ConditionalFact]
[Fact]
public async Task NotDllImport_NoDiagnostic()
{
string source = @$"
Expand Down
Loading