-
Notifications
You must be signed in to change notification settings - Fork 32
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
Replace mono with .NET 8 support #120
base: release-1.7
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,36 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<!-- NOTE: must be net46, not net472 to run Mono tests --> | ||
<TargetFrameworks>net6.0;net462</TargetFrameworks> | ||
<!-- net462 is currently the oldest .NET Framework version supported per https://learn.microsoft.com/en-us/lifecycle/products/microsoft-net-framework --> | ||
<!-- net6.0 and net8.0 are the only .NET Core versions supported per https://learn.microsoft.com/en-us/lifecycle/products/microsoft-net-and-net-core --> | ||
<!-- Should stay in sync with SampleCommand.csproj --> | ||
<TargetFrameworks>net8.0;net6.0;net462</TargetFrameworks> | ||
<IsPackable>false</IsPackable> | ||
<LangVersion>Latest</LangVersion> | ||
<Nullable>enable</Nullable> | ||
<GenerateDocumentationFile>True</GenerateDocumentationFile> | ||
<CodeAnalysisRuleSet>..\stylecop.analyzers.ruleset</CodeAnalysisRuleSet> | ||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors> | ||
<GenerateDocumentationFile>True</GenerateDocumentationFile> | ||
<CodeAnalysisRuleSet>..\stylecop.analyzers.ruleset</CodeAnalysisRuleSet> | ||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors> | ||
<NoWarn>1591</NoWarn> | ||
<RootNamespace>Medallion.Shell.Tests</RootNamespace> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="nunit" Version="3.13.3" /> | ||
<PackageReference Include="NUnit3TestAdapter" Version="4.4.0-beta.1" /> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" /> | ||
<PackageReference Include="Moq" Version="4.7.63" /> | ||
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.435"> | ||
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" /> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" /> | ||
<PackageReference Include="Moq" Version="4.7.63" /> | ||
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.435"> | ||
<PrivateAssets>All</PrivateAssets> | ||
</PackageReference> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\MedallionShell\MedallionShell.csproj" /> | ||
<ProjectReference Include="..\SampleCommand\SampleCommand.csproj" /> | ||
<ProjectReference Include="..\SampleCommand\SampleCommand.csproj" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup Condition="'$(TargetFramework)' == 'net462'"> | ||
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This way, we don't have to update this line when we change from net462 to net472. You can see that this technique is being used in https://github.com/AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet/blob/dev/src/Microsoft.IdentityModel.Protocols/Microsoft.IdentityModel.Protocols.csproj#L29. |
||
<Reference Include="Microsoft.CSharp" /> | ||
<Reference Include="System.Management" /> | ||
<Reference Include="System.ServiceModel" /> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,19 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Linq.Expressions; | ||
using System.Runtime.InteropServices; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using NUnit.Framework; | ||
using SampleCommand; | ||
|
||
namespace Medallion.Shell.Tests | ||
{ | ||
using System.IO; | ||
using static UnitTestHelpers; | ||
|
||
public class PlatformCompatibilityTest | ||
{ | ||
[Test] | ||
public Task TestReadAfterExit() => RunTestAsync(() => PlatformCompatibilityTests.TestReadAfterExit()); | ||
|
||
[Test] | ||
public Task TestWriteAfterExit() => RunTestAsync(() => PlatformCompatibilityTests.TestWriteAfterExit()); | ||
// TODO: fix in https://github.com/madelson/MedallionShell/issues/117 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this is fine for now because this must be fixed before 1.7 is released. |
||
//[Test] | ||
//public Task TestWriteAfterExit() => RunTestAsync(() => PlatformCompatibilityTests.TestWriteAfterExit()); | ||
|
||
[Test] | ||
public Task TestFlushAfterExit() => RunTestAsync(() => PlatformCompatibilityTests.TestFlushAfterExit()); | ||
|
@@ -50,33 +44,7 @@ private static async Task RunTestAsync(Expression<Action> testMethod) | |
var compiled = testMethod.Compile(); | ||
Assert.DoesNotThrow(() => compiled(), "should run on current platform"); | ||
|
||
// don't bother testing running Mono from .NET Core or Mono itself | ||
#if NETFRAMEWORK | ||
if (!PlatformCompatibilityHelper.IsMono) | ||
{ | ||
var methodName = ((MethodCallExpression)testMethod.Body).Method.Name; | ||
|
||
var monoPath = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? @"C:\Program Files\Mono\bin\mono.exe" : "/usr/bin/mono"; | ||
if (!File.Exists(monoPath)) | ||
{ | ||
// https://www.appveyor.com/docs/environment-variables/ | ||
if (Environment.GetEnvironmentVariable("APPVEYOR")?.ToLowerInvariant() == "true") | ||
{ | ||
// not on VS2017 VM yet: https://www.appveyor.com/docs/windows-images-software/ | ||
Console.WriteLine("On APPVEYOR with no Mono installed; skipping mono test"); | ||
return; | ||
} | ||
|
||
Assert.Fail($"Could not find mono install at {monoPath}"); | ||
} | ||
|
||
var command = Command.Run(monoPath, SampleCommand, nameof(PlatformCompatibilityTests), methodName); | ||
await command.Task; | ||
command.Result.Success.ShouldEqual(true, "should run on Mono. Got: " + command.Result.StandardError); | ||
} | ||
#else | ||
await Task.CompletedTask; // make the compiler happy | ||
#endif | ||
} | ||
} | ||
} |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whenever I wasn't sure what to do about Mono-related comments, I either deleted it or modified it so that it shows up in the diff.