Skip to content

Commit

Permalink
Merge pull request #9418 from vzarytovskii/new-testing-proposal
Browse files Browse the repository at this point in the history
  • Loading branch information
vzarytovskii committed Jun 16, 2020
2 parents ae024e9 + 2538d20 commit d53716c
Show file tree
Hide file tree
Showing 84 changed files with 959 additions and 673 deletions.
41 changes: 40 additions & 1 deletion FSharp.sln
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "fsiAnyCpu", "src\fsharp\fsi
{649FA588-F02E-457C-9FCF-87E46407481E} = {649FA588-F02E-457C-9FCF-87E46407481E}
EndProjectSection
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.TestsHelpers", "tests\FSharp.TestHelpers\FSharp.TestHelpers.fsproj", "{60D275B0-B14A-41CB-A1B2-E815A7448FCB} "
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.TestsHelpers", "tests\FSharp.Test.Utilities\FSharp.Test.Utilities.fsproj", "{60D275B0-B14A-41CB-A1B2-E815A7448FCB} "
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharpSuite.Tests", "tests\fsharp\FSharpSuite.Tests.fsproj", "{C163E892-5BF7-4B59-AA99-B0E8079C67C4}"
EndProject
Expand Down Expand Up @@ -52,6 +52,16 @@ Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Compiler.Private.Scr
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "DependencyManager", "src\fsharp\Microsoft.DotNet.DependencyManager\Microsoft.DotNet.DependencyManager.fsproj", "{B5A043F8-6D7F-4D4E-B8AD-5880070180B6}"
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.Compiler.ComponentTests", "tests\FSharp.Compiler.ComponentTests\FSharp.Compiler.ComponentTests.fsproj", "{FAC5A3BF-C0D6-437A-868A-E962AA00B418}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "fsharpqa", "fsharpqa", "{292C4F92-A313-4CAF-9552-731F39C6C21F}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "testenv", "testenv", "{FF76050A-415A-4FB4-A0E5-13CBF38D83E0}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{07482B5E-4980-4285-B732-820F15870284}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PEVerify", "tests\fsharpqa\testenv\src\PEVerify\PEVerify.csproj", "{25568CD2-E654-4C8F-BE5B-59BABFC5BD20}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -278,6 +288,30 @@ Global
{B5A043F8-6D7F-4D4E-B8AD-5880070180B6}.Release|Any CPU.Build.0 = Release|Any CPU
{B5A043F8-6D7F-4D4E-B8AD-5880070180B6}.Release|x86.ActiveCfg = Release|Any CPU
{B5A043F8-6D7F-4D4E-B8AD-5880070180B6}.Release|x86.Build.0 = Release|Any CPU
{FAC5A3BF-C0D6-437A-868A-E962AA00B418}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FAC5A3BF-C0D6-437A-868A-E962AA00B418}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FAC5A3BF-C0D6-437A-868A-E962AA00B418}.Debug|x86.ActiveCfg = Debug|Any CPU
{FAC5A3BF-C0D6-437A-868A-E962AA00B418}.Debug|x86.Build.0 = Debug|Any CPU
{FAC5A3BF-C0D6-437A-868A-E962AA00B418}.Proto|Any CPU.ActiveCfg = Debug|Any CPU
{FAC5A3BF-C0D6-437A-868A-E962AA00B418}.Proto|Any CPU.Build.0 = Debug|Any CPU
{FAC5A3BF-C0D6-437A-868A-E962AA00B418}.Proto|x86.ActiveCfg = Debug|Any CPU
{FAC5A3BF-C0D6-437A-868A-E962AA00B418}.Proto|x86.Build.0 = Debug|Any CPU
{FAC5A3BF-C0D6-437A-868A-E962AA00B418}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FAC5A3BF-C0D6-437A-868A-E962AA00B418}.Release|Any CPU.Build.0 = Release|Any CPU
{FAC5A3BF-C0D6-437A-868A-E962AA00B418}.Release|x86.ActiveCfg = Release|Any CPU
{FAC5A3BF-C0D6-437A-868A-E962AA00B418}.Release|x86.Build.0 = Release|Any CPU
{25568CD2-E654-4C8F-BE5B-59BABFC5BD20}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{25568CD2-E654-4C8F-BE5B-59BABFC5BD20}.Debug|Any CPU.Build.0 = Debug|Any CPU
{25568CD2-E654-4C8F-BE5B-59BABFC5BD20}.Debug|x86.ActiveCfg = Debug|Any CPU
{25568CD2-E654-4C8F-BE5B-59BABFC5BD20}.Debug|x86.Build.0 = Debug|Any CPU
{25568CD2-E654-4C8F-BE5B-59BABFC5BD20}.Proto|Any CPU.ActiveCfg = Debug|Any CPU
{25568CD2-E654-4C8F-BE5B-59BABFC5BD20}.Proto|Any CPU.Build.0 = Debug|Any CPU
{25568CD2-E654-4C8F-BE5B-59BABFC5BD20}.Proto|x86.ActiveCfg = Debug|Any CPU
{25568CD2-E654-4C8F-BE5B-59BABFC5BD20}.Proto|x86.Build.0 = Debug|Any CPU
{25568CD2-E654-4C8F-BE5B-59BABFC5BD20}.Release|Any CPU.ActiveCfg = Release|Any CPU
{25568CD2-E654-4C8F-BE5B-59BABFC5BD20}.Release|Any CPU.Build.0 = Release|Any CPU
{25568CD2-E654-4C8F-BE5B-59BABFC5BD20}.Release|x86.ActiveCfg = Release|Any CPU
{25568CD2-E654-4C8F-BE5B-59BABFC5BD20}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -300,6 +334,11 @@ Global
{6771860A-614D-4FDD-A655-4C70EBCC91B0} = {B8DDA694-7939-42E3-95E5-265C2217C142}
{4FEDF286-0252-4EBC-9E75-879CCA3B85DC} = {CFE3259A-2D30-4EB0-80D5-E8B5F3D01449}
{B5A043F8-6D7F-4D4E-B8AD-5880070180B6} = {3881429D-A97A-49EB-B7AE-A82BA5FE9C77}
{FAC5A3BF-C0D6-437A-868A-E962AA00B418} = {CFE3259A-2D30-4EB0-80D5-E8B5F3D01449}
{292C4F92-A313-4CAF-9552-731F39C6C21F} = {CFE3259A-2D30-4EB0-80D5-E8B5F3D01449}
{FF76050A-415A-4FB4-A0E5-13CBF38D83E0} = {292C4F92-A313-4CAF-9552-731F39C6C21F}
{07482B5E-4980-4285-B732-820F15870284} = {FF76050A-415A-4FB4-A0E5-13CBF38D83E0}
{25568CD2-E654-4C8F-BE5B-59BABFC5BD20} = {07482B5E-4980-4285-B732-820F15870284}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {BD5177C7-1380-40E7-94D2-7768E1A8B1B8}
Expand Down
1 change: 1 addition & 0 deletions FSharpBuild.Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<!-- directory locations -->
<PropertyGroup>
<FSharpSourcesRoot>$(RepoRoot)src</FSharpSourcesRoot>
<FSharpTestsRoot>$(RepoRoot)tests</FSharpTestsRoot>
<SymStoreDirectory>$(ArtifactsDir)\SymStore</SymStoreDirectory>
<ProtoOutputPath>$(ArtifactsDir)\Bootstrap</ProtoOutputPath>
<ValueTupleImplicitPackageVersion>4.4.0</ValueTupleImplicitPackageVersion>
Expand Down
17 changes: 16 additions & 1 deletion VisualFSharp.sln
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "fsiAnyCpu", "src\fsharp\fsi
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "fsi", "src\fsharp\fsi\fsi.fsproj", "{D0E98C0D-490B-4C61-9329-0862F6E87645}"
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.TestsHelpers", "tests\FSharp.TestHelpers\FSharp.TestHelpers.fsproj", "{60D275B0-B14A-41CB-A1B2-E815A7448FCB} "
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.TestsHelpers", "tests\FSharp.Test.Utilities\FSharp.Test.Utilities.fsproj", "{60D275B0-B14A-41CB-A1B2-E815A7448FCB} "
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharpSuite.Tests", "tests\fsharp\FSharpSuite.Tests.fsproj", "{C163E892-5BF7-4B59-AA99-B0E8079C67C4}"
EndProject
Expand Down Expand Up @@ -160,6 +160,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TutorialProject", "vsintegr
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Microsoft.DotNet.DependencyManager", "src\fsharp\Microsoft.DotNet.DependencyManager\Microsoft.DotNet.DependencyManager.fsproj", "{C2F38485-5F87-4986-985B-55D7ED96D5CE}"
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.Compiler.ComponentTests", "tests\FSharp.Compiler.ComponentTests\FSharp.Compiler.ComponentTests.fsproj", "{0610FB97-7C15-422A-86FD-32335C6DF14D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -938,6 +940,18 @@ Global
{C2F38485-5F87-4986-985B-55D7ED96D5CE}.Release|Any CPU.Build.0 = Release|Any CPU
{C2F38485-5F87-4986-985B-55D7ED96D5CE}.Release|x86.ActiveCfg = Release|Any CPU
{C2F38485-5F87-4986-985B-55D7ED96D5CE}.Release|x86.Build.0 = Release|Any CPU
{0610FB97-7C15-422A-86FD-32335C6DF14D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0610FB97-7C15-422A-86FD-32335C6DF14D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0610FB97-7C15-422A-86FD-32335C6DF14D}.Debug|x86.ActiveCfg = Debug|Any CPU
{0610FB97-7C15-422A-86FD-32335C6DF14D}.Debug|x86.Build.0 = Debug|Any CPU
{0610FB97-7C15-422A-86FD-32335C6DF14D}.Proto|Any CPU.ActiveCfg = Debug|Any CPU
{0610FB97-7C15-422A-86FD-32335C6DF14D}.Proto|Any CPU.Build.0 = Debug|Any CPU
{0610FB97-7C15-422A-86FD-32335C6DF14D}.Proto|x86.ActiveCfg = Debug|Any CPU
{0610FB97-7C15-422A-86FD-32335C6DF14D}.Proto|x86.Build.0 = Debug|Any CPU
{0610FB97-7C15-422A-86FD-32335C6DF14D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0610FB97-7C15-422A-86FD-32335C6DF14D}.Release|Any CPU.Build.0 = Release|Any CPU
{0610FB97-7C15-422A-86FD-32335C6DF14D}.Release|x86.ActiveCfg = Release|Any CPU
{0610FB97-7C15-422A-86FD-32335C6DF14D}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -1013,6 +1027,7 @@ Global
{B53D9D05-8EF7-43A6-9A5B-0B113CBC54F8} = {12EF27FD-A34B-4373-860A-F9FCE9651859}
{2937CBEC-262D-4C94-BE1D-291FAB72E3E8} = {12EF27FD-A34B-4373-860A-F9FCE9651859}
{C2F38485-5F87-4986-985B-55D7ED96D5CE} = {3881429D-A97A-49EB-B7AE-A82BA5FE9C77}
{0610FB97-7C15-422A-86FD-32335C6DF14D} = {CFE3259A-2D30-4EB0-80D5-E8B5F3D01449}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {48EDBBBE-C8EE-4E3C-8B19-97184A487B37}
Expand Down
2 changes: 2 additions & 0 deletions eng/Build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,7 @@ try {
$coreclrTargetFramework = "netcoreapp3.1"

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

if ($testCoreClr) {
TestUsingNUnit -testProject "$RepoRoot\tests\FSharp.Compiler.ComponentTests\FSharp.Compiler.ComponentTests.fsproj" -targetFramework $coreclrTargetFramework
TestUsingNUnit -testProject "$RepoRoot\tests\FSharp.Compiler.UnitTests\FSharp.Compiler.UnitTests.fsproj" -targetFramework $coreclrTargetFramework
TestUsingNUnit -testProject "$RepoRoot\tests\FSharp.Compiler.Private.Scripting.UnitTests\FSharp.Compiler.Private.Scripting.UnitTests.fsproj" -targetFramework $coreclrTargetFramework
TestUsingNUnit -testProject "$RepoRoot\tests\FSharp.Build.UnitTests\FSharp.Build.UnitTests.fsproj" -targetFramework $coreclrTargetFramework
Expand Down
4 changes: 3 additions & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@
<MicrosoftNetCompilersVersion>2.7.0</MicrosoftNetCompilersVersion>
<MicrosoftNETCoreILDAsmVersion>3.0.0-preview-27318-01</MicrosoftNETCoreILDAsmVersion>
<MicrosoftNETCoreILAsmVersion>3.0.0-preview-27318-01</MicrosoftNETCoreILAsmVersion>
<MicrosoftNETTestSdkVersion>15.8.0</MicrosoftNETTestSdkVersion>
<MicrosoftNETTestSdkVersion>16.6.1</MicrosoftNETTestSdkVersion>
<MicrosoftWin32RegistryVersion>4.3.0</MicrosoftWin32RegistryVersion>
<NewtonsoftJsonVersion>9.0.1</NewtonsoftJsonVersion>
<NUnitVersion>3.11.0</NUnitVersion>
Expand All @@ -186,5 +186,7 @@
<RoslynToolsSignToolVersion>1.0.0-beta2-dev3</RoslynToolsSignToolVersion>
<StrawberryPerlVersion>5.28.0.1</StrawberryPerlVersion>
<StreamJsonRpcVersion>2.0.187</StreamJsonRpcVersion>
<XUnitVersion>2.4.1</XUnitVersion>
<FluentAssertionsVersion>5.10.3</FluentAssertionsVersion>
</PropertyGroup>
</Project>
9 changes: 5 additions & 4 deletions eng/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -201,14 +201,14 @@ function BuildSolution {

InitializeToolset
local toolset_build_proj=$_InitializeToolset

local bl=""
if [[ "$binary_log" = true ]]; then
bl="/bl:\"$log_dir/Build.binlog\""
fi
local projects="$repo_root/$solution"

local projects="$repo_root/$solution"

# https://github.com/dotnet/roslyn/issues/23736
local enable_analyzers=!$skip_analyzers
UNAME="$(uname)"
Expand Down Expand Up @@ -294,6 +294,7 @@ BuildSolution

if [[ "$test_core_clr" == true ]]; then
coreclrtestframework=netcoreapp3.1
TestUsingNUnit --testproject "$repo_root/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj" --targetframework $coreclrtestframework
TestUsingNUnit --testproject "$repo_root/tests/FSharp.Compiler.UnitTests/FSharp.Compiler.UnitTests.fsproj" --targetframework $coreclrtestframework
TestUsingNUnit --testproject "$repo_root/tests/FSharp.Compiler.Private.Scripting.UnitTests/FSharp.Compiler.Private.Scripting.UnitTests.fsproj" --targetframework $coreclrtestframework
TestUsingNUnit --testproject "$repo_root/tests/FSharp.Build.UnitTests/FSharp.Build.UnitTests.fsproj" --targetframework $coreclrtestframework
Expand Down
6 changes: 6 additions & 0 deletions tests/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,11 @@
<PackageReference Include="NUnit3TestAdapter" Version="$(NUnit3TestAdapterVersion)" />
<PackageReference Include="NunitXml.TestLogger" Version="$(NunitXmlTestLoggerVersion)" />
</ItemGroup>
<ItemGroup Condition="'$(UnitTestType)' == 'xunit'">
<!-- <PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNETTestSdkVersion)" /> -->
<PackageReference Include="xunit" Version="$(XUnitVersion)" />
<PackageReference Include="xunit.runner.visualstudio" Version="$(XUnitVersion)" />
<PackageReference Include="NunitXml.TestLogger" Version="$(NunitXmlTestLoggerVersion)" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.

namespace FSharp.Compiler.UnitTests
namespace FSharp.Compiler.ComponentTests

open NUnit.Framework
open FSharp.TestHelpers
open Xunit
open FSharp.Test.Utilities
open FSharp.Compiler.SourceCodeServices

[<TestFixture>]
module ``Invalid Numeric Literal`` =

[<Test>]
[<Fact>]
let ``1up is invalid Numeric Literal``() =
CompilerAssert.TypeCheckSingleError
"""
Expand All @@ -18,4 +17,4 @@ let foo = 1up // int
FSharpErrorSeverity.Error
1156
(2, 11, 2, 14)
"This is not a valid numeric literal. Valid numeric literals include 1, 0x1, 0o1, 0b1, 1l (int), 1u (uint32), 1L (int64), 1UL (uint64), 1s (int16), 1y (sbyte), 1uy (byte), 1.0 (float), 1.0f (float32), 1.0m (decimal), 1I (BigInteger)."
"This is not a valid numeric literal. Valid numeric literals include 1, 0x1, 0o1, 0b1, 1l (int), 1u (uint32), 1L (int64), 1UL (uint64), 1s (int16), 1y (sbyte), 1uy (byte), 1.0 (float), 1.0f (float32), 1.0m (decimal), 1I (BigInteger)."
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. -->
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net472;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' == 'Unix'">netcoreapp3.1</TargetFrameworks>
<ReferenceVsAssemblies>true</ReferenceVsAssemblies>
<OutputType>Library</OutputType>
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
<Optimize>false</Optimize>
<Tailcalls>false</Tailcalls>
<OtherFlags>$(OtherFlags) --warnon:1182</OtherFlags>
<UnitTestType>xunit</UnitTestType>
<NoWarn>$(NoWarn);3186;1104;FS0988</NoWarn>
</PropertyGroup>

<ItemGroup>
<Compile Include="ErrorMessages/InvalidNumericLiteralTests.fs" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="$(FSharpSourcesRoot)\fsharp\FSharp.Compiler.Private\FSharp.Compiler.Private.fsproj" />
<ProjectReference Include="$(FSharpSourcesRoot)\fsharp\FSharp.Core\FSharp.Core.fsproj" />
<ProjectReference Include="$(FSharpTestsRoot)\FSharp.Test.Utilities\FSharp.Test.Utilities.fsproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Net.Compilers" Version="$(MicrosoftNetCompilersVersion)" />
<PackageReference Include="Microsoft.NETCore.ILDAsm" Version="$(MicrosoftNETCoreILDAsmVersion)" />
<PackageReference Include="Microsoft.NETCore.ILAsm" Version="$(MicrosoftNETCoreILAsmVersion)" />
<PackageReference Include="System.Collections.Immutable" Version="$(SystemCollectionsImmutableVersion)" />
<PackageReference Include="System.Memory" Version="$(SystemMemoryVersion)" />
<PackageReference Include="System.Reflection.Metadata" Version="$(SystemReflectionMetadataVersion)" />
<PackageReference Include="System.Runtime.Loader" Version="$(SystemRuntimeLoaderVersion)" />
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.Common" Version="$(MicrosoftCodeAnalysisWorkspacesCommonVersion)" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="$(MicrosoftCodeAnalysisCSharpVersion)" />
<PackageReference Include="Microsoft.CodeAnalysis.Test.Resources.Proprietary" Version="$(MicrosoftCodeAnalysisTestResourcesProprietaryVersion)" />
</ItemGroup>
</Project>
9 changes: 5 additions & 4 deletions tests/FSharp.Compiler.UnitTests/ByteMemoryTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ namespace FSharp.Compiler.UnitTests

open System
open System.Globalization
open NUnit.Framework
open Xunit
open FSharp.Test.Utilities


[<TestFixture>]
module ByteMemoryTests =
open FSharp.Compiler.AbstractIL.Internal

[<Test>]
[<Fact>]
let ``ByteMemory.CreateMemoryMappedFile succeeds with byte length of zero``() =
let memory = ByteMemory.Empty.AsReadOnly()
let newMemory = ByteMemory.CreateMemoryMappedFile memory
Assert.AreEqual(0, newMemory.Length)
Assert.shouldBe(0, newMemory.Length)
30 changes: 16 additions & 14 deletions tests/FSharp.Compiler.UnitTests/EditDistance.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,25 @@ namespace FSharp.Compiler.UnitTests

open System
open System.Globalization
open NUnit.Framework
open Xunit
open FSharp.Test.Utilities

[<TestFixture>]
module EditDistance =
open Internal.Utilities.EditDistance

[<Test>]
[<TestCase("RICK", "RICK", ExpectedResult = "1.000")>]
[<TestCase("MARTHA", "MARHTA", ExpectedResult = "0.961")>]
[<TestCase("DWAYNE", "DUANE", ExpectedResult = "0.840")>]
[<TestCase("DIXON", "DICKSONX", ExpectedResult = "0.813")>]
let JaroWinklerTest (str1 : string, str2 : string) : string =
[<Theory>]
[<InlineData("RICK", "RICK", "1.000")>]
[<InlineData("MARTHA", "MARHTA", "0.961")>]
[<InlineData("DWAYNE", "DUANE", "0.840")>]
[<InlineData("DIXON", "DICKSONX", "0.813")>]
let JaroWinklerTest (str1 : string, str2 : string, expected : string) : unit =
String.Format(CultureInfo.InvariantCulture, "{0:0.000}", JaroWinklerDistance str1 str2)
|> Assert.shouldBe expected

[<Test>]
[<TestCase("RICK", "RICK", ExpectedResult = 0)>]
[<TestCase("MARTHA", "MARHTA", ExpectedResult = 1)>]
[<TestCase("'T", "'u", ExpectedResult = 1)>]
let EditDistanceTest (str1 : string, str2 : string) : int =
CalcEditDistance(str1,str2)
[<Theory>]
[<InlineData("RICK", "RICK", 0)>]
[<InlineData("MARTHA", "MARHTA", 1)>]
[<InlineData("'T", "'u", 1)>]
let EditDistanceTest (str1 : string, str2 : string, expected : int) : unit =
CalcEditDistance(str1,str2)
|> Assert.shouldBe expected
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
<TargetFrameworks Condition="'$(OS)' == 'Unix'">netcoreapp3.1</TargetFrameworks>
<OutputType>Library</OutputType>
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
<UnitTestType>nunit</UnitTestType>
<UnitTestType>xunit</UnitTestType>
<NoWarn>$(NoWarn);3186;1104</NoWarn>
</PropertyGroup>

<ItemGroup>
<Compile Include="NunitHelpers.fs" />
<Compile Include="CompilerTestHelpers.fs" />
<Compile Include="ManglingNameOfProvidedTypes.fs" />
<Compile Include="HashIfExpression.fs" />
Expand All @@ -25,6 +25,7 @@
<ItemGroup>
<ProjectReference Include="$(FSharpSourcesRoot)\fsharp\FSharp.Compiler.Private\FSharp.Compiler.Private.fsproj" />
<ProjectReference Include="$(FSharpSourcesRoot)\fsharp\FSharp.Core\FSharp.Core.fsproj" />
<ProjectReference Include="$(FSharpTestsRoot)\FSharp.Test.Utilities\FSharp.Test.Utilities.fsproj" />
</ItemGroup>

</Project>
Loading

0 comments on commit d53716c

Please sign in to comment.