Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Use 6.0 preview 6 for testing
  • Loading branch information
buyaa-n committed Jul 26, 2021
commit ad21395f70fc5bd981ad4150c9c8725c4c29eb79
Original file line number Diff line number Diff line change
Expand Up @@ -4022,7 +4022,7 @@ void SupportedOnWindowsLinuxOsx() { }

[SupportedOSPlatform(""linux"")]
void SupportedOnLinux() { }
}" + MockApisCsSource;
}";

await VerifyAnalyzerAsyncCs(source, s_msBuildPlatforms,
VerifyCS.Diagnostic(PlatformCompatibilityAnalyzer.OnlySupportedCsAllPlatforms).WithLocation(0).
Expand Down Expand Up @@ -4101,7 +4101,7 @@ void UnsupportedOnLinux() { }
[UnsupportedOSPlatform(""Linux"")]
[UnsupportedOSPlatform(""ios"")]
void UnsupportedOnLinuxWindowsIos() { }
}" + MockApisCsSource;
}";

await VerifyAnalyzerAsyncCs(source, s_msBuildPlatforms);
}
Expand Down Expand Up @@ -4165,7 +4165,7 @@ void SupportedOnWindows10LinuxMacOS14() { }

[SupportedOSPlatform(""windows8.0"")]
void SupportedOnWindows8() { }
}" + MockApisCsSource;
}";

await VerifyAnalyzerAsyncCs(source, s_msBuildPlatforms,
VerifyCS.Diagnostic(PlatformCompatibilityAnalyzer.UnsupportedCsReachable).WithLocation(0).WithArguments("Test.UnsupportedOnLinuxWindows10Ios91()",
Expand Down Expand Up @@ -4250,7 +4250,7 @@ void SupportedOnWindowsUntil10AndLinux() { }
[SupportedOSPlatform(""Windows"")]
[UnsupportedOSPlatform(""Windows10.0"")]
void SupportedOnWindowsUntil10() { }
}" + MockApisCsSource;
}";

await VerifyAnalyzerAsyncCs(source, s_msBuildPlatforms,
VerifyCS.Diagnostic(PlatformCompatibilityAnalyzer.UnsupportedCsReachable).WithLocation(0).WithArguments("Test.UnsupportedOnWindows8IosSupportsIos14_19()",
Expand Down Expand Up @@ -4323,7 +4323,7 @@ void SupportedOnWindows10Linux() { }

[SupportedOSPlatform(""windows8.0"")]
void SupportedOnWindows8() { }
}" + MockApisCsSource;
}";

await VerifyAnalyzerAsyncCs(source, s_msBuildPlatforms);
}
Expand Down Expand Up @@ -4375,7 +4375,7 @@ public static void M1() { }
public static bool IsSupported { get; }
public static void M2() { }
}
" + MockApisCsSource;
";

await VerifyAnalyzerAsyncCs(source, s_msBuildPlatforms);
}
Expand Down Expand Up @@ -4450,31 +4450,6 @@ void M1()
#endif

private readonly string MockApisCsSource = @"
namespace System.Runtime.Versioning
{
[AttributeUsage(AttributeTargets.Class |
AttributeTargets.Method |
AttributeTargets.Property |
AttributeTargets.Field |
AttributeTargets.Struct,
AllowMultiple = true, Inherited = false)]
public sealed class SupportedOSPlatformGuardAttribute : Attribute
{
public SupportedOSPlatformGuardAttribute(string platformName) { }
}

[AttributeUsage(AttributeTargets.Class |
AttributeTargets.Method |
AttributeTargets.Property |
AttributeTargets.Field |
AttributeTargets.Struct,
AllowMultiple = true, Inherited = false)]
public sealed class UnsupportedOSPlatformGuardAttribute : Attribute
{
public UnsupportedOSPlatformGuardAttribute(string platformName) { }
}
}

namespace System
{
public class MockOperatingSystem
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3975,7 +3975,7 @@ private static VerifyCS.Test PopulateTestCs(string sourceCode, params Diagnostic
var test = new VerifyCS.Test
{
TestCode = sourceCode,
ReferenceAssemblies = ReferenceAssemblies.Net.Net50,
ReferenceAssemblies = AdditionalMetadataReferences.Net60,
MarkupOptions = MarkupOptions.UseFirstDescriptor,
TestState = { }
};
Expand Down Expand Up @@ -4027,7 +4027,7 @@ private static VerifyVB.Test PopulateTestVb(string sourceCode, params Diagnostic
var test = new VerifyVB.Test
{
TestCode = sourceCode,
ReferenceAssemblies = ReferenceAssemblies.Net.Net50,
ReferenceAssemblies = AdditionalMetadataReferences.Net60,
MarkupOptions = MarkupOptions.UseFirstDescriptor,
TestState = { },
};
Expand Down