Skip to content

Commit 79c64d9

Browse files
authored
Update Xunit version, migrate FSharpSuite.Tests to Xunit (#17652)
* bump xunit, move suite to xunit * fix * min diff * temp disable transparent compiler check * restore cast tests exact behavior * cleanup * unnecessary * signedtest * clean * remove UseCulture * cleanup
1 parent 871f981 commit 79c64d9

File tree

82 files changed

+1041
-1106
lines changed

Some content is hidden

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

82 files changed

+1041
-1106
lines changed

eng/Versions.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,8 @@
196196
<RoslynToolsSignToolVersion>1.0.0-beta2-dev3</RoslynToolsSignToolVersion>
197197
<StreamJsonRpcVersion>2.18.48</StreamJsonRpcVersion>
198198
<NerdbankStreamsVersion>2.10.69</NerdbankStreamsVersion>
199-
<XUnitVersion>2.4.1</XUnitVersion>
200-
<XUnitRunnerVersion>2.4.2</XUnitRunnerVersion>
199+
<XUnitVersion>2.9.0</XUnitVersion>
200+
<XUnitRunnerVersion>2.8.2</XUnitRunnerVersion>
201201
<FluentAssertionsVersion>5.10.3</FluentAssertionsVersion>
202202
<HumanizerCoreVersion>2.2.0</HumanizerCoreVersion>
203203
<!-- -->

tests/FSharp.Compiler.ComponentTests/ErrorMessages/Repro1548.fs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ namespace ErrorMessages
44

55
open Xunit
66
open FSharp.Test.Compiler
7-
open FSharp.Test.Utilities
8-
open NUnit.Framework
97
open FSharp.Compiler.Diagnostics
108
open FSharp.Test
119

tests/FSharp.Compiler.Service.Tests/MultiProjectAnalysisTests.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ let z = Project1.x
444444
ReferencedProjects = [| FSharpReferencedProject.FSharpReference(MultiProjectDirty1.dllName, MultiProjectDirty1.getOptions()) |] }
445445

446446
[<Theory>]
447-
[<InlineData(true)>]
447+
// [<InlineData(true)>]
448448
[<InlineData(false)>]
449449
let ``Test multi project symbols should pick up changes in dependent projects`` useTransparentCompiler =
450450

tests/FSharp.Test.Utilities/ProjectGeneration.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -742,7 +742,7 @@ module ProjectOperations =
742742
expectOk result ()
743743
Assert.NotEqual<string>(oldSignature, newSignature)
744744

745-
let expectSignatureContains expected result (_oldSignature, newSignature) =
745+
let expectSignatureContains (expected: string) result (_oldSignature, newSignature) =
746746
expectOk result ()
747747
Assert.Contains(expected, newSignature)
748748

tests/FSharp.Test.Utilities/TestFramework.fs

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ open System.IO
77
open System.Reflection
88
open System.Diagnostics
99
open Scripting
10-
open NUnit.Framework
10+
open Xunit
1111
open FSharp.Compiler.IO
1212

1313
let inline getTestsDirectory src dir = src ++ dir
@@ -463,21 +463,6 @@ let initializeSuite () =
463463

464464
let suiteHelpers = lazy (initializeSuite ())
465465

466-
[<AttributeUsage(AttributeTargets.Assembly)>]
467-
type public InitializeSuiteAttribute () =
468-
inherit TestActionAttribute()
469-
470-
override x.BeforeTest details =
471-
try
472-
if details.IsSuite
473-
then suiteHelpers.Force() |> ignore
474-
with
475-
| e -> raise (Exception("failed test suite initialization, debug code in InitializeSuiteAttribute", e))
476-
override x.AfterTest _details =
477-
()
478-
479-
override x.Targets = ActionTargets.Test ||| ActionTargets.Suite
480-
481466
let testConfig (testDir: string) =
482467
let cfg = suiteHelpers.Value
483468
if not (Path.IsPathRooted testDir) then

tests/FSharp.Test.Utilities/Utilities.fs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,27 +13,27 @@ open System.Threading.Tasks
1313
open Microsoft.CodeAnalysis
1414
open Microsoft.CodeAnalysis.CSharp
1515
open TestFramework
16-
open NUnit.Framework
16+
open Xunit
1717
open System.Collections.Generic
1818
open FSharp.Compiler.CodeAnalysis
1919
open Newtonsoft.Json
2020
open Newtonsoft.Json.Linq
2121

2222

2323
type TheoryForNETCOREAPPAttribute() =
24-
inherit Xunit.TheoryAttribute()
24+
inherit TheoryAttribute()
2525
#if !NETCOREAPP
2626
do base.Skip <- "Only NETCOREAPP is supported runtime for this kind of test."
2727
#endif
2828

2929
type FactForNETCOREAPPAttribute() =
30-
inherit Xunit.FactAttribute()
30+
inherit FactAttribute()
3131
#if !NETCOREAPP
3232
do base.Skip <- "Only NETCOREAPP is supported runtime for this kind of test."
3333
#endif
3434

3535
type FactForDESKTOPAttribute() =
36-
inherit Xunit.FactAttribute()
36+
inherit FactAttribute()
3737
#if NETCOREAPP
3838
do base.Skip <- "NETCOREAPP is not supported runtime for this kind of test, it is intended for DESKTOP only"
3939
#endif

tests/fsharp/Compiler/CodeGen/EmittedIL/BooleanLogic.fs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@
33
namespace FSharp.Compiler.UnitTests.CodeGen.EmittedIL
44

55
open FSharp.Test
6-
open NUnit.Framework
6+
open Xunit
77

8-
[<TestFixture>]
98
module BooleanLogic =
109

11-
[<Test>]
10+
[<Fact>]
1211
let BooleanOrs() =
1312
CompilerAssert.CompileLibraryAndVerifyILWithOptions ([|"-g"; "--optimize+"|],
1413
"""
@@ -54,7 +53,7 @@ let compute (x: int) =
5453
"""
5554
]))
5655

57-
[<TestFixture>]
56+
5857
// We had a regression in debug code regression where we were falsely marking pipelines
5958
// as non-side-effecting, causing them to be eliminated in loops.
6059
//
@@ -63,7 +62,7 @@ let compute (x: int) =
6362
// 2. we don't eliminate loops anyway
6463
module DontEliminateForLoopsInDebugCode =
6564

66-
[<Test>]
65+
[<Fact>]
6766
// See https://github.com/dotnet/fsharp/pull/12021
6867
let Regression12021() =
6968
CompilerAssert.CompileLibraryAndVerifyILWithOptions([|"-g"; "--optimize-"|],

tests/fsharp/Compiler/CodeGen/EmittedIL/ByrefTailcalls.fs

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

55
open FSharp.Test
6-
open NUnit.Framework
6+
open Xunit
77

88
open System
99
open System.Threading.Tasks
1010

11-
[<TestFixture>]
1211
module ByrefTailcalls =
1312

14-
[<Test>]
13+
[<Fact>]
1514
let ``check no tailcall to inref``() =
1615
CompilerAssert.CompileLibraryAndVerifyILWithOptions([| "/optimize";"/tailcalls" |],
1716
"""

tests/fsharp/Compiler/CodeGen/EmittedIL/CeEdiThrow.fs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@
22
namespace FSharp.Compiler.UnitTests.CodeGen.EmittedIL
33

44
open FSharp.Compiler.UnitTests
5-
open NUnit.Framework
5+
open Xunit
66
open FSharp.Test
77

8-
[<TestFixture>]
98
module CeEdiThrow =
109

11-
[<Test>]
10+
[<Fact>]
1211
let ``Emits EDI.Throw``() =
1312
CompilerAssert.CompileLibraryAndVerifyIL(
1413
"""

tests/fsharp/Compiler/CodeGen/EmittedIL/ComputationExpressionOptimizations.fs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
namespace FSharp.Compiler.UnitTests.CodeGen.EmittedIL
44

55
open FSharp.Test
6-
open NUnit.Framework
6+
open Xunit
77

88
open System
99

1010
#if !DEBUG // sensitive to debug-level code coming across from debug FSharp.Core
11-
[<TestFixture>]
11+
1212
module ComputationExpressionOptimizations =
1313

14-
[<Test>]
14+
[<Fact>]
1515
// See https://github.com/fsharp/fslang-design/blob/master/tooling/FST-1034-lambda-optimizations.md
1616
//
1717
// This tests a number of code optimizations cooperating together.

0 commit comments

Comments
 (0)