Skip to content

Commit 79846a4

Browse files
committed
Added new xUnit test project Compiler.UnitTests
1 parent f13d49e commit 79846a4

8 files changed

Lines changed: 83 additions & 5 deletions

File tree

FSharp.sln

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Compiler.Private.Scr
5252
EndProject
5353
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "DependencyManager", "src\fsharp\Microsoft.DotNet.DependencyManager\Microsoft.DotNet.DependencyManager.fsproj", "{B5A043F8-6D7F-4D4E-B8AD-5880070180B6}"
5454
EndProject
55+
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.Compiler.ComponentTests", "tests\FSharp.Compiler.ComponentTests\FSharp.Compiler.ComponentTests.fsproj", "{FAC5A3BF-C0D6-437A-868A-E962AA00B418}"
56+
EndProject
5557
Global
5658
GlobalSection(SolutionConfigurationPlatforms) = preSolution
5759
Debug|Any CPU = Debug|Any CPU
@@ -278,6 +280,18 @@ Global
278280
{B5A043F8-6D7F-4D4E-B8AD-5880070180B6}.Release|Any CPU.Build.0 = Release|Any CPU
279281
{B5A043F8-6D7F-4D4E-B8AD-5880070180B6}.Release|x86.ActiveCfg = Release|Any CPU
280282
{B5A043F8-6D7F-4D4E-B8AD-5880070180B6}.Release|x86.Build.0 = Release|Any CPU
283+
{FAC5A3BF-C0D6-437A-868A-E962AA00B418}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
284+
{FAC5A3BF-C0D6-437A-868A-E962AA00B418}.Debug|Any CPU.Build.0 = Debug|Any CPU
285+
{FAC5A3BF-C0D6-437A-868A-E962AA00B418}.Debug|x86.ActiveCfg = Debug|Any CPU
286+
{FAC5A3BF-C0D6-437A-868A-E962AA00B418}.Debug|x86.Build.0 = Debug|Any CPU
287+
{FAC5A3BF-C0D6-437A-868A-E962AA00B418}.Proto|Any CPU.ActiveCfg = Debug|Any CPU
288+
{FAC5A3BF-C0D6-437A-868A-E962AA00B418}.Proto|Any CPU.Build.0 = Debug|Any CPU
289+
{FAC5A3BF-C0D6-437A-868A-E962AA00B418}.Proto|x86.ActiveCfg = Debug|Any CPU
290+
{FAC5A3BF-C0D6-437A-868A-E962AA00B418}.Proto|x86.Build.0 = Debug|Any CPU
291+
{FAC5A3BF-C0D6-437A-868A-E962AA00B418}.Release|Any CPU.ActiveCfg = Release|Any CPU
292+
{FAC5A3BF-C0D6-437A-868A-E962AA00B418}.Release|Any CPU.Build.0 = Release|Any CPU
293+
{FAC5A3BF-C0D6-437A-868A-E962AA00B418}.Release|x86.ActiveCfg = Release|Any CPU
294+
{FAC5A3BF-C0D6-437A-868A-E962AA00B418}.Release|x86.Build.0 = Release|Any CPU
281295
EndGlobalSection
282296
GlobalSection(SolutionProperties) = preSolution
283297
HideSolutionNode = FALSE
@@ -300,6 +314,7 @@ Global
300314
{6771860A-614D-4FDD-A655-4C70EBCC91B0} = {B8DDA694-7939-42E3-95E5-265C2217C142}
301315
{4FEDF286-0252-4EBC-9E75-879CCA3B85DC} = {CFE3259A-2D30-4EB0-80D5-E8B5F3D01449}
302316
{B5A043F8-6D7F-4D4E-B8AD-5880070180B6} = {3881429D-A97A-49EB-B7AE-A82BA5FE9C77}
317+
{FAC5A3BF-C0D6-437A-868A-E962AA00B418} = {CFE3259A-2D30-4EB0-80D5-E8B5F3D01449}
303318
EndGlobalSection
304319
GlobalSection(ExtensibilityGlobals) = postSolution
305320
SolutionGuid = {BD5177C7-1380-40E7-94D2-7768E1A8B1B8}

VisualFSharp.sln

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TutorialProject", "vsintegr
160160
EndProject
161161
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Microsoft.DotNet.DependencyManager", "src\fsharp\Microsoft.DotNet.DependencyManager\Microsoft.DotNet.DependencyManager.fsproj", "{C2F38485-5F87-4986-985B-55D7ED96D5CE}"
162162
EndProject
163+
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.Compiler.ComponentTests", "tests\FSharp.Compiler.ComponentTests\FSharp.Compiler.ComponentTests.fsproj", "{0610FB97-7C15-422A-86FD-32335C6DF14D}"
164+
EndProject
163165
Global
164166
GlobalSection(SolutionConfigurationPlatforms) = preSolution
165167
Debug|Any CPU = Debug|Any CPU
@@ -938,6 +940,18 @@ Global
938940
{C2F38485-5F87-4986-985B-55D7ED96D5CE}.Release|Any CPU.Build.0 = Release|Any CPU
939941
{C2F38485-5F87-4986-985B-55D7ED96D5CE}.Release|x86.ActiveCfg = Release|Any CPU
940942
{C2F38485-5F87-4986-985B-55D7ED96D5CE}.Release|x86.Build.0 = Release|Any CPU
943+
{0610FB97-7C15-422A-86FD-32335C6DF14D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
944+
{0610FB97-7C15-422A-86FD-32335C6DF14D}.Debug|Any CPU.Build.0 = Debug|Any CPU
945+
{0610FB97-7C15-422A-86FD-32335C6DF14D}.Debug|x86.ActiveCfg = Debug|Any CPU
946+
{0610FB97-7C15-422A-86FD-32335C6DF14D}.Debug|x86.Build.0 = Debug|Any CPU
947+
{0610FB97-7C15-422A-86FD-32335C6DF14D}.Proto|Any CPU.ActiveCfg = Debug|Any CPU
948+
{0610FB97-7C15-422A-86FD-32335C6DF14D}.Proto|Any CPU.Build.0 = Debug|Any CPU
949+
{0610FB97-7C15-422A-86FD-32335C6DF14D}.Proto|x86.ActiveCfg = Debug|Any CPU
950+
{0610FB97-7C15-422A-86FD-32335C6DF14D}.Proto|x86.Build.0 = Debug|Any CPU
951+
{0610FB97-7C15-422A-86FD-32335C6DF14D}.Release|Any CPU.ActiveCfg = Release|Any CPU
952+
{0610FB97-7C15-422A-86FD-32335C6DF14D}.Release|Any CPU.Build.0 = Release|Any CPU
953+
{0610FB97-7C15-422A-86FD-32335C6DF14D}.Release|x86.ActiveCfg = Release|Any CPU
954+
{0610FB97-7C15-422A-86FD-32335C6DF14D}.Release|x86.Build.0 = Release|Any CPU
941955
EndGlobalSection
942956
GlobalSection(SolutionProperties) = preSolution
943957
HideSolutionNode = FALSE
@@ -1013,6 +1027,7 @@ Global
10131027
{B53D9D05-8EF7-43A6-9A5B-0B113CBC54F8} = {12EF27FD-A34B-4373-860A-F9FCE9651859}
10141028
{2937CBEC-262D-4C94-BE1D-291FAB72E3E8} = {12EF27FD-A34B-4373-860A-F9FCE9651859}
10151029
{C2F38485-5F87-4986-985B-55D7ED96D5CE} = {3881429D-A97A-49EB-B7AE-A82BA5FE9C77}
1030+
{0610FB97-7C15-422A-86FD-32335C6DF14D} = {CFE3259A-2D30-4EB0-80D5-E8B5F3D01449}
10161031
EndGlobalSection
10171032
GlobalSection(ExtensibilityGlobals) = postSolution
10181033
SolutionGuid = {48EDBBBE-C8EE-4E3C-8B19-97184A487B37}

eng/Build.ps1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,7 @@ try {
451451
$coreclrTargetFramework = "netcoreapp3.0"
452452

453453
if ($testDesktop -and -not $noVisualStudio) {
454+
TestUsingNUnit -testProject "$RepoRoot\tests\FSharp.Compiler.ComponentTests\FSharp.Compiler.ComponentTests.fsproj" -targetFramework $desktopTargetFramework
454455
TestUsingNUnit -testProject "$RepoRoot\tests\FSharp.Compiler.UnitTests\FSharp.Compiler.UnitTests.fsproj" -targetFramework $desktopTargetFramework
455456
TestUsingNUnit -testProject "$RepoRoot\tests\FSharp.Compiler.Private.Scripting.UnitTests\FSharp.Compiler.Private.Scripting.UnitTests.fsproj" -targetFramework $desktopTargetFramework
456457
TestUsingNUnit -testProject "$RepoRoot\tests\FSharp.Build.UnitTests\FSharp.Build.UnitTests.fsproj" -targetFramework $desktopTargetFramework
@@ -459,6 +460,7 @@ try {
459460
}
460461

461462
if ($testCoreClr) {
463+
TestUsingNUnit -testProject "$RepoRoot\tests\FSharp.Compiler.ComponentTests\FSharp.Compiler.ComponentTests.fsproj" -targetFramework $coreclrTargetFramework
462464
TestUsingNUnit -testProject "$RepoRoot\tests\FSharp.Compiler.UnitTests\FSharp.Compiler.UnitTests.fsproj" -targetFramework $coreclrTargetFramework
463465
TestUsingNUnit -testProject "$RepoRoot\tests\FSharp.Compiler.Private.Scripting.UnitTests\FSharp.Compiler.Private.Scripting.UnitTests.fsproj" -targetFramework $coreclrTargetFramework
464466
TestUsingNUnit -testProject "$RepoRoot\tests\FSharp.Build.UnitTests\FSharp.Build.UnitTests.fsproj" -targetFramework $coreclrTargetFramework

eng/build.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ BuildSolution
294294

295295
if [[ "$test_core_clr" == true ]]; then
296296
coreclrtestframework=netcoreapp3.0
297+
TestUsingNUnit --testproject "$repo_root/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj" --targetframework $coreclrtestframework
297298
TestUsingNUnit --testproject "$repo_root/tests/FSharp.Compiler.UnitTests/FSharp.Compiler.UnitTests.fsproj" --targetframework $coreclrtestframework
298299
TestUsingNUnit --testproject "$repo_root/tests/FSharp.Compiler.Private.Scripting.UnitTests/FSharp.Compiler.Private.Scripting.UnitTests.fsproj" --targetframework $coreclrtestframework
299300
TestUsingNUnit --testproject "$repo_root/tests/FSharp.Build.UnitTests/FSharp.Build.UnitTests.fsproj" --targetframework $coreclrtestframework
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<Project>
2+
3+
<PropertyGroup>
4+
<UseFSharpProductVersion>true</UseFSharpProductVersion>
5+
</PropertyGroup>
6+
7+
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))" />
8+
9+
</Project>

tests/fsharp/Compiler/ErrorMessages/InvalidNumericLiteralTests.fs renamed to tests/FSharp.Compiler.ComponentTests/ErrorMessages/InvalidNumericLiteralTests.fs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
22

3-
namespace FSharp.Compiler.UnitTests
3+
namespace FSharp.Compiler.ComponentTests
44

5-
open NUnit.Framework
5+
open Xunit
66
open FSharp.Test.Utilities
77
open FSharp.Compiler.SourceCodeServices
88

9-
[<TestFixture>]
109
module ``Invalid Numeric Literal`` =
1110

12-
[<Test>]
11+
[<Fact>]
1312
let ``1up is invalid Numeric Literal``() =
1413
CompilerAssert.TypeCheckSingleError
1514
"""
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. -->
3+
<Project Sdk="Microsoft.NET.Sdk">
4+
5+
<PropertyGroup>
6+
<TargetFrameworks>net472;netcoreapp3.0</TargetFrameworks>
7+
<TargetFrameworks Condition="'$(OS)' == 'Unix'">netcoreapp3.0</TargetFrameworks>
8+
<OutputType>Library</OutputType>
9+
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
10+
<OtherFlags>$(OtherFlags) --warnon:1182</OtherFlags>
11+
<UnitTestType>xunit</UnitTestType>
12+
<NoWarn>$(NoWarn);3186;1104</NoWarn>
13+
</PropertyGroup>
14+
15+
<ItemGroup>
16+
<Compile Include="ErrorMessages/InvalidNumericLiteralTests.fs" />
17+
</ItemGroup>
18+
19+
<ItemGroup>
20+
<ProjectReference Include="$(FSharpSourcesRoot)\fsharp\FSharp.Compiler.Private\FSharp.Compiler.Private.fsproj" />
21+
<ProjectReference Include="$(FSharpSourcesRoot)\fsharp\FSharp.Core\FSharp.Core.fsproj" />
22+
<ProjectReference Include="$(FSharpTestsRoot)\FSharp.Test.Utilities\FSharp.Test.Utilities.fsproj" />
23+
</ItemGroup>
24+
25+
<ItemGroup>
26+
<PackageReference Include="Microsoft.Net.Compilers" Version="$(MicrosoftNetCompilersVersion)" />
27+
<PackageReference Include="Microsoft.NETCore.ILDAsm" Version="$(MicrosoftNETCoreILDAsmVersion)" />
28+
<PackageReference Include="Microsoft.NETCore.ILAsm" Version="$(MicrosoftNETCoreILAsmVersion)" />
29+
<PackageReference Include="System.Collections.Immutable" Version="$(SystemCollectionsImmutableVersion)" />
30+
<PackageReference Include="System.Memory" Version="$(SystemMemoryVersion)" />
31+
<PackageReference Include="System.Reflection.Metadata" Version="$(SystemReflectionMetadataVersion)" />
32+
<PackageReference Include="System.Runtime.Loader" Version="$(SystemRuntimeLoaderVersion)" />
33+
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.Common" Version="$(MicrosoftCodeAnalysisWorkspacesCommonVersion)" />
34+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="$(MicrosoftCodeAnalysisCSharpVersion)" />
35+
<PackageReference Include="Microsoft.CodeAnalysis.Test.Resources.Proprietary" Version="$(MicrosoftCodeAnalysisTestResourcesProprietaryVersion)" />
36+
</ItemGroup>
37+
</Project>

tests/FSharp.Compiler.UnitTests/FSharp.Compiler.UnitTests.fsproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<OutputType>Library</OutputType>
99
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
1010
<UnitTestType>xunit</UnitTestType>
11-
<NoWarn>$(NoWarn);3186;1104;NETSDK1023</NoWarn>
11+
<NoWarn>$(NoWarn);3186;1104</NoWarn>
1212
</PropertyGroup>
1313

1414
<ItemGroup>

0 commit comments

Comments
 (0)