Skip to content

Commit f18511f

Browse files
majochapsfinaki
andauthored
Fix FSharpSuite net472 xUnit migration (#17660)
* fix quotes test, update readme * Update SpanTests.fs --------- Co-authored-by: Petr <[email protected]>
1 parent bb027e1 commit f18511f

File tree

6 files changed

+18
-9
lines changed

6 files changed

+18
-9
lines changed

tests/fsharp/Compiler/Language/SpanTests.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ type T(span: Span<byte>) = struct end
176176
"""
177177
[| |]
178178

179-
[<Test>]
179+
[<Fact>]
180180
let ``A byref struct with custom attr can be passed as typar``() =
181181
CompilerAssert.TypeCheckWithErrors """
182182
namespace System.Runtime.CompilerServices
@@ -193,4 +193,4 @@ module WhatEver =
193193
let processT (a: Action<T>, ie: seq<T>, asList: list<T>) = ()
194194
"""
195195
[| FSharpDiagnosticSeverity.Error, 3300, (13, 45, 13, 51), "The parameter 'asList' has an invalid type 'T list'. This is not permitted by the rules of Common IL." |]
196-
#endif
196+
#endif

tests/fsharp/FSharpSuite.Tests.fsproj

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<Compile Include="..\scripts\scriptlib.fsx">
2121
<Link>scriptlib.fsx</Link>
2222
</Compile>
23-
<Compile Include="NUnitHelpers.fs" />
23+
<Compile Include="XunitHelpers.fs" />
2424
<Compile Include="HandleExpects.fs" />
2525
<Compile Include="single-test.fs" />
2626
<Compile Include="TypeProviderTests.fs" />
@@ -100,6 +100,10 @@
100100
<EmbeddedResource Remove="**" />
101101
</ItemGroup>
102102

103+
<ItemGroup>
104+
<Content Include="xunit.runner.json" CopyToOutputDirectory="PreserveNewest" />
105+
</ItemGroup>
106+
103107
<ItemGroup>
104108
<ProjectReference Include="$(FSharpSourcesRoot)\FSharp.Build\FSharp.Build.fsproj" />
105109
<ProjectReference Include="$(FSharpSourcesRoot)\Compiler\FSharp.Compiler.Service.fsproj" />
File renamed without changes.

tests/fsharp/core/quotes/cslib.dll

3.5 KB
Binary file not shown.

tests/fsharp/readme.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
## Layout
44

5-
The tests are NUNIT test cases. They test a very wide range of compiler, interactive and FSharp.Core scenarios.
5+
The tests are xUnit test cases. They test a very wide range of compiler, interactive and FSharp.Core scenarios.
66

77
The bulk of the test cases are enumerated in tests.fs, these are the old cambridge test suite. They build on a test-suite ported from windows batch files. They run the compiler and fsi as separate processes, when built for the coreclr it runs the coreclr versions using dotnet.exe
88

99
The framework and utilities can be found in test-framework.fs, single-test.fs.
1010

1111
test cases look similar to:
1212
````
13-
[<Test>]
13+
[<Fact>]
1414
let ``array-FSI`` () = singleTestBuildAndRun "core/array" FSI
1515
````
1616
This test case builds and runs the test case in the folder core/array
@@ -20,7 +20,7 @@ __#if !NETCOREAPP__
2020

2121
There are some older tests in this section that looks similar to:
2222
````
23-
[<Test>]
23+
[<Fact>]
2424
let events () =
2525
let cfg = testConfig "core/events"
2626
fsc cfg "%s -a -o:test.dll -g" cfg.fsc_flags ["test.fs"]
@@ -34,11 +34,11 @@ There are some older tests in this section that looks similar to:
3434
````
3535
These tests build, compile, peverify and run fsi.
3636

37-
Below the Compiler directory there is a set of tests built on the compiler service. They are nunit and instead of executing the compiler and fsi using files on disk the tests are built from memory. These tests use the CompilerAssert framework and look similar to:
37+
Below the Compiler directory there is a set of tests built on the compiler service. They are xUnit and instead of executing the compiler and fsi using files on disk the tests are built from memory. These tests use the CompilerAssert framework and look similar to:
3838

3939
This test verifies that a warning is produces when a value is implicitly discarded. The line ````x = 20``` looks like an assignment but in F# is a test for equality it yields and discards the value false.
4040
````
41-
[<Test>]
41+
[<Fact>]
4242
let ``Unused compare with immutable when assignment might be intended``() =
4343
CompilerAssert.TypeCheckSingleError
4444
"""
@@ -62,4 +62,4 @@ When a test is run, .err/.vserr output files are created and compared to their m
6262

6363
Refer to [Test Guide](../../TESTGUIDE.md#baselines) to know more about how to update them.
6464

65-
Tests are organized under modules as functions bearing NUnit `[<Test>]` attribute and can be run from an IDE or the command line (see the [Test Guide](../../TESTGUIDE.md)).
65+
Tests are organized under modules as functions bearing xUnit `[<Fact>]` attribute and can be run from an IDE or the command line (see the [Test Guide](../../TESTGUIDE.md)).

tests/fsharp/xunit.runner.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"$schema": "https://xunit.net/schema/current/xunit.runner.schema.json",
3+
"appDomain": "ifAvailable",
4+
"shadowCopy": false
5+
}

0 commit comments

Comments
 (0)