Skip to content

Commit d9014b2

Browse files
committed
[WIP] Moving to xUnit
1 parent 079276b commit d9014b2

72 files changed

Lines changed: 299 additions & 284 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

FSharp.sln

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "fsiAnyCpu", "src\fsharp\fsi
2424
{649FA588-F02E-457C-9FCF-87E46407481E} = {649FA588-F02E-457C-9FCF-87E46407481E}
2525
EndProjectSection
2626
EndProject
27-
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.TestsHelpers", "tests\FSharp.TestHelpers\FSharp.TestHelpers.fsproj", "{60D275B0-B14A-41CB-A1B2-E815A7448FCB} "
27+
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.TestsHelpers", "tests\FSharp.Test.Utilities\FSharp.Test.Utilities.fsproj", "{60D275B0-B14A-41CB-A1B2-E815A7448FCB} "
2828
EndProject
2929
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharpSuite.Tests", "tests\fsharp\FSharpSuite.Tests.fsproj", "{C163E892-5BF7-4B59-AA99-B0E8079C67C4}"
3030
EndProject

VisualFSharp.sln

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "fsiAnyCpu", "src\fsharp\fsi
8686
EndProject
8787
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "fsi", "src\fsharp\fsi\fsi.fsproj", "{D0E98C0D-490B-4C61-9329-0862F6E87645}"
8888
EndProject
89-
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.TestsHelpers", "tests\FSharp.TestHelpers\FSharp.TestHelpers.fsproj", "{60D275B0-B14A-41CB-A1B2-E815A7448FCB} "
89+
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.TestsHelpers", "tests\FSharp.Test.Utilities\FSharp.Test.Utilities.fsproj", "{60D275B0-B14A-41CB-A1B2-E815A7448FCB} "
9090
EndProject
9191
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharpSuite.Tests", "tests\fsharp\FSharpSuite.Tests.fsproj", "{C163E892-5BF7-4B59-AA99-B0E8079C67C4}"
9292
EndProject

eng/Versions.props

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@
176176
<MicrosoftNetCompilersVersion>2.7.0</MicrosoftNetCompilersVersion>
177177
<MicrosoftNETCoreILDAsmVersion>3.0.0-preview-27318-01</MicrosoftNETCoreILDAsmVersion>
178178
<MicrosoftNETCoreILAsmVersion>3.0.0-preview-27318-01</MicrosoftNETCoreILAsmVersion>
179-
<MicrosoftNETTestSdkVersion>15.8.0</MicrosoftNETTestSdkVersion>
179+
<MicrosoftNETTestSdkVersion>16.6.1</MicrosoftNETTestSdkVersion>
180180
<MicrosoftWin32RegistryVersion>4.3.0</MicrosoftWin32RegistryVersion>
181181
<NewtonsoftJsonVersion>9.0.1</NewtonsoftJsonVersion>
182182
<NUnitVersion>3.11.0</NUnitVersion>
@@ -186,5 +186,7 @@
186186
<RoslynToolsSignToolVersion>1.0.0-beta2-dev3</RoslynToolsSignToolVersion>
187187
<StrawberryPerlVersion>5.28.0.1</StrawberryPerlVersion>
188188
<StreamJsonRpcVersion>2.0.187</StreamJsonRpcVersion>
189+
<XUnitVersion>2.4.1</XUnitVersion>
190+
<FluentAssertionsVersion>2.4.1</FluentAssertionsVersion>
189191
</PropertyGroup>
190192
</Project>

tests/Directory.Build.targets

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,11 @@
88
<PackageReference Include="NUnit3TestAdapter" Version="$(NUnit3TestAdapterVersion)" />
99
<PackageReference Include="NunitXml.TestLogger" Version="$(NunitXmlTestLoggerVersion)" />
1010
</ItemGroup>
11+
<ItemGroup Condition="'$(UnitTestType)' == 'xunit'">
12+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNETTestSdkVersion)" />
13+
<PackageReference Include="xunit" Version="$(XUnitVersion)" />
14+
<PackageReference Include="xunit.runner.visualstudio" Version="$(XUnitVersion)" />
15+
<PackageReference Include="NunitXml.TestLogger" Version="$(NunitXmlTestLoggerVersion)" />
16+
</ItemGroup>
1117

1218
</Project>

tests/FSharp.Compiler.UnitTests/ByteMemoryTests.fs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@ namespace FSharp.Compiler.UnitTests
33

44
open System
55
open System.Globalization
6-
open NUnit.Framework
6+
open Xunit
7+
open FSharp.Test.Utilities
8+
79

8-
[<TestFixture>]
910
module ByteMemoryTests =
1011
open FSharp.Compiler.AbstractIL.Internal
1112

12-
[<Test>]
13+
[<Fact>]
1314
let ``ByteMemory.CreateMemoryMappedFile succeeds with byte length of zero``() =
1415
let memory = ByteMemory.Empty.AsReadOnly()
1516
let newMemory = ByteMemory.CreateMemoryMappedFile memory
16-
Assert.AreEqual(0, newMemory.Length)
17+
Assert.shouldBe(0, newMemory.Length)

tests/FSharp.Compiler.UnitTests/EditDistance.fs

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,25 @@ namespace FSharp.Compiler.UnitTests
33

44
open System
55
open System.Globalization
6-
open NUnit.Framework
6+
open Xunit
7+
open FSharp.Test.Utilities
78

8-
[<TestFixture>]
99
module EditDistance =
1010
open Internal.Utilities.EditDistance
1111

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

20-
[<Test>]
21-
[<TestCase("RICK", "RICK", ExpectedResult = 0)>]
22-
[<TestCase("MARTHA", "MARHTA", ExpectedResult = 1)>]
23-
[<TestCase("'T", "'u", ExpectedResult = 1)>]
24-
let EditDistanceTest (str1 : string, str2 : string) : int =
25-
CalcEditDistance(str1,str2)
21+
[<Theory>]
22+
[<InlineData("RICK", "RICK", 0)>]
23+
[<InlineData("MARTHA", "MARHTA", 1)>]
24+
[<InlineData("'T", "'u", 1)>]
25+
let EditDistanceTest (str1 : string, str2 : string, expected : string) : unit =
26+
CalcEditDistance(str1,str2)
27+
|> Assert.shouldBe expected

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@
77
<TargetFrameworks Condition="'$(OS)' == 'Unix'">netcoreapp3.0</TargetFrameworks>
88
<OutputType>Library</OutputType>
99
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
10-
<UnitTestType>nunit</UnitTestType>
10+
<UnitTestType>xunit</UnitTestType>
1111
</PropertyGroup>
1212

1313
<ItemGroup>
14-
<Compile Include="NunitHelpers.fs" />
1514
<Compile Include="CompilerTestHelpers.fs" />
1615
<Compile Include="ManglingNameOfProvidedTypes.fs" />
1716
<Compile Include="HashIfExpression.fs" />

0 commit comments

Comments
 (0)