Skip to content

Commit

Permalink
Added simple collection of AOT tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sakno committed Dec 29, 2024
1 parent 9a5e42e commit e4aeace
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="8.0.1" />
<PackageVersion Include="Microsoft.IO.RecyclableMemoryStream" Version="3.0.1" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageVersion Include="MSTest.Engine" Version="1.0.0-alpha.24562.1" />
<PackageVersion Include="MSTest.SourceGeneration" Version="1.0.0-alpha.24562.1" />
<PackageVersion Include="Microsoft.Testing.Extensions.TrxReport" Version="1.0.2" />
<PackageVersion Include="Microsoft.Testing.Platform.MSBuild" Version="1.5.0" />
<PackageVersion Include="MSTest.TestFramework" Version="3.7.0" />
<PackageVersion Include="MSTest.Analyzers" Version="3.7.0" />
</ItemGroup>
<ItemGroup>
<!--Misc packages-->
Expand Down
31 changes: 31 additions & 0 deletions src/DotNext.AotTests/DotNext.AotTests.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>DotNext</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Version>5.17.0</Version>
<IsPackable>false</IsPackable>
<Authors>.NET Foundation and Contributors</Authors>
<Product>.NEXT Family of Libraries</Product>
<Description>AOT compatibility tests for .NEXT Familiy of Libraries</Description>
<Copyright>Copyright © .NET Foundation and Contributors</Copyright>
<PackageLicenseUrl>https://github.com/dotnet/DotNext/blob/master/LICENSE</PackageLicenseUrl>
<PackageProjectUrl>https://github.com/dotnet/DotNext</PackageProjectUrl>
<RepositoryUrl>https://github.com/dotnet/DotNext.git</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<InvariantGlobalization>true</InvariantGlobalization>
<PublishAot>true</PublishAot>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\DotNext\DotNext.csproj"/>
<PackageReference Include="MSTest.Engine" />
<PackageReference Include="MSTest.SourceGeneration" />
<PackageReference Include="Microsoft.Testing.Extensions.TrxReport" />
<PackageReference Include="Microsoft.Testing.Platform.MSBuild"/>
<PackageReference Include="MSTest.TestFramework" />
<PackageReference Include="MSTest.Analyzers" />
</ItemGroup>
</Project>
25 changes: 25 additions & 0 deletions src/DotNext.AotTests/Reflection/TaskTypeTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace DotNext.Reflection;

[TestClass]
public class TaskTypeTests
{
[TestMethod]
public void IsCompletedSuccessfullyPropertyGetter()
{
Assert.IsTrue(TaskType.IsCompletedSuccessfullyGetter(Task.CompletedTask));
}

[TestMethod]
public void GetResultSynchronously()
{
Assert.AreEqual(42, TaskType.GetResultGetter<int>().Invoke(Task.FromResult(42)));
}

[TestMethod]
public void IsCompletedPropertyGetter()
{
Assert.IsTrue(Task.CompletedTask.GetIsCompletedGetter().Invoke());
}
}
2 changes: 1 addition & 1 deletion src/DotNext.Tests/Reflection/TaskTypeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ public static void GetResultSynchronously()
[Fact]
public static void IsCompletedPropertyGetter()
{
True(TaskType.GetIsCompletedGetter(Task.CompletedTask).Invoke());
True(Task.CompletedTask.GetIsCompletedGetter().Invoke());
}
}
9 changes: 9 additions & 0 deletions src/DotNext.sln
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommandLineAMI", "examples\
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RandomAccessCacheBenchmark", "examples\RandomAccessCacheBenchmark\RandomAccessCacheBenchmark.csproj", "{73185946-8EFD-4153-8AC4-05AFD8BAC2E4}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotNext.AotTests", "DotNext.AotTests\DotNext.AotTests.csproj", "{155A8FEF-5FDD-42D3-AC31-335542FC588C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Bench|Any CPU = Bench|Any CPU
Expand Down Expand Up @@ -133,6 +135,12 @@ Global
{73185946-8EFD-4153-8AC4-05AFD8BAC2E4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{73185946-8EFD-4153-8AC4-05AFD8BAC2E4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{73185946-8EFD-4153-8AC4-05AFD8BAC2E4}.Release|Any CPU.Build.0 = Release|Any CPU
{155A8FEF-5FDD-42D3-AC31-335542FC588C}.Bench|Any CPU.ActiveCfg = Debug|Any CPU
{155A8FEF-5FDD-42D3-AC31-335542FC588C}.Bench|Any CPU.Build.0 = Debug|Any CPU
{155A8FEF-5FDD-42D3-AC31-335542FC588C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{155A8FEF-5FDD-42D3-AC31-335542FC588C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{155A8FEF-5FDD-42D3-AC31-335542FC588C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{155A8FEF-5FDD-42D3-AC31-335542FC588C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -146,6 +154,7 @@ Global
{1A2FAA85-95B5-4377-B430-622DC5000C89} = {F8DCA620-40E7-411E-8970-85DC808B6BAF}
{39583DDE-E579-44AD-B7AF-5BB77D979E55} = {F8DCA620-40E7-411E-8970-85DC808B6BAF}
{73185946-8EFD-4153-8AC4-05AFD8BAC2E4} = {F8DCA620-40E7-411E-8970-85DC808B6BAF}
{155A8FEF-5FDD-42D3-AC31-335542FC588C} = {4956E982-79AA-462C-B592-E904D24EFFAE}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {1CE24157-AFE0-4CDF-B063-2876343F0A66}
Expand Down

0 comments on commit e4aeace

Please sign in to comment.