diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index c602e244..6bbb2bcf 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -3,7 +3,7 @@ "isRoot": true, "tools": { "paket": { - "version": "7.1.5", + "version": "7.2.0", "commands": [ "paket" ] @@ -15,13 +15,13 @@ ] }, "fsdocs-tool": { - "version": "16.1.1", + "version": "17.2.0", "commands": [ "fsdocs" ] }, "fantomas": { - "version": "5.0.6", + "version": "5.1.5", "commands": [ "fantomas" ] diff --git a/paket.dependencies b/paket.dependencies index 71ec3714..f1a3a9f1 100644 --- a/paket.dependencies +++ b/paket.dependencies @@ -1,7 +1,7 @@ source https://api.nuget.org/v3/index.json -framework: net6.0, netstandard2.0 +framework: net6.0, net7.0, netstandard2.0 -nuget FSharp.Core ~> 5.0.0 +nuget FSharp.Core ~> 6.0.0 nuget Microsoft.NET.Test.Sdk diff --git a/paket.lock b/paket.lock index bc594482..dfd46048 100644 --- a/paket.lock +++ b/paket.lock @@ -1,44 +1,42 @@ -RESTRICTION: || (== net6.0) (== netstandard2.0) +RESTRICTION: || (== net6.0) (== net7.0) (== netstandard2.0) NUGET remote: https://api.nuget.org/v3/index.json - FSharp.Core (5.0.2) - Microsoft.CodeCoverage (17.3.2) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= net45)) (&& (== netstandard2.0) (>= netcoreapp1.0)) - Microsoft.NET.Test.Sdk (17.3.2) - Microsoft.CodeCoverage (>= 17.3.2) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= net45)) (&& (== netstandard2.0) (>= netcoreapp1.0)) - Microsoft.TestPlatform.TestHost (>= 17.3.2) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp1.0)) - Microsoft.NETCore.Platforms (6.0.6) + FSharp.Core (6.0.7) + Microsoft.CodeCoverage (17.4.1) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net462)) (&& (== netstandard2.0) (>= netcoreapp3.1)) + Microsoft.NET.Test.Sdk (17.4.1) + Microsoft.CodeCoverage (>= 17.4.1) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net462)) (&& (== netstandard2.0) (>= netcoreapp3.1)) + Microsoft.TestPlatform.TestHost (>= 17.4.1) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= netcoreapp3.1)) + Microsoft.NETCore.Platforms (7.0) Microsoft.NETCore.Targets (5.0) - Microsoft.TestPlatform.ObjectModel (17.3.2) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp1.0)) + Microsoft.TestPlatform.ObjectModel (17.4.1) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= netcoreapp3.1)) NuGet.Frameworks (>= 5.11) System.Reflection.Metadata (>= 1.6) - Microsoft.TestPlatform.TestHost (17.3.2) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp1.0)) - Microsoft.TestPlatform.ObjectModel (>= 17.3.2) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp1.0)) (&& (== netstandard2.0) (>= uap10.0)) - Newtonsoft.Json (>= 9.0.1) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp1.0)) (&& (== netstandard2.0) (>= uap10.0)) + Microsoft.TestPlatform.TestHost (17.4.1) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= netcoreapp3.1)) + Microsoft.TestPlatform.ObjectModel (>= 17.4.1) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= netcoreapp3.1)) + Newtonsoft.Json (>= 13.0.1) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= netcoreapp3.1)) MSTest.TestAdapter (2.1.2) - NETStandard.Library (>= 1.6.1) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp1.0)) - System.Diagnostics.TextWriterTraceListener (>= 4.3) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp1.0)) - MSTest.TestFramework (2.2.10) - NETStandard.Library (>= 1.6.1) - restriction: || (&& (== net6.0) (< net5.0)) (== netstandard2.0) - System.Diagnostics.TextWriterTraceListener (>= 4.3) - restriction: || (&& (== net6.0) (< net5.0)) (== netstandard2.0) + NETStandard.Library (>= 1.6.1) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= netcoreapp1.0)) + System.Diagnostics.TextWriterTraceListener (>= 4.3) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= netcoreapp1.0)) + MSTest.TestFramework (3.0.2) NETStandard.Library (2.0.3) Microsoft.NETCore.Platforms (>= 1.1) - Newtonsoft.Json (13.0.1) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp1.0)) - NHamcrest (3.0.1) - NuGet.Frameworks (6.3.1) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp1.0)) (&& (== netstandard2.0) (>= netcoreapp2.1)) + Newtonsoft.Json (13.0.2) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= netcoreapp3.1)) + NHamcrest (3.1) + NuGet.Frameworks (6.4) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= netcoreapp3.1)) NUnit (3.13.3) NETStandard.Library (>= 2.0) - NUnit3TestAdapter (4.2.1) - runtime.native.System (4.3.1) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp1.0)) + NUnit3TestAdapter (4.3.1) + runtime.native.System (4.3.1) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= netcoreapp1.0)) Microsoft.NETCore.Platforms (>= 1.1.1) Microsoft.NETCore.Targets (>= 1.1.3) - System.Buffers (4.5.1) - restriction: || (&& (== net6.0) (>= net461)) (== netstandard2.0) - System.Collections (4.3) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp1.0)) + System.Buffers (4.5.1) - restriction: || (&& (== net6.0) (>= net462)) (&& (== net7.0) (>= monotouch)) (&& (== net7.0) (>= net461)) (&& (== net7.0) (>= net462)) (&& (== net7.0) (< net6.0) (>= xamarinios)) (&& (== net7.0) (< net6.0) (>= xamarinmac)) (&& (== net7.0) (< net6.0) (>= xamarintvos)) (&& (== net7.0) (< net6.0) (>= xamarinwatchos)) (&& (== net7.0) (< netcoreapp2.0)) (&& (== net7.0) (< netstandard1.1)) (&& (== net7.0) (< netstandard2.0)) (== netstandard2.0) + System.Collections (4.3) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= netcoreapp1.0)) Microsoft.NETCore.Platforms (>= 1.1) Microsoft.NETCore.Targets (>= 1.1) System.Runtime (>= 4.3) - System.Collections.Immutable (6.0) - System.Memory (>= 4.5.4) - restriction: || (&& (== net6.0) (>= net461)) (== netstandard2.0) - System.Runtime.CompilerServices.Unsafe (>= 6.0) + System.Collections.Immutable (7.0) + System.Memory (>= 4.5.5) - restriction: || (&& (== net6.0) (>= net462)) (&& (== net7.0) (>= net462)) (&& (== net7.0) (< net6.0)) (== netstandard2.0) + System.Runtime.CompilerServices.Unsafe (>= 6.0) - restriction: || (== net6.0) (&& (== net7.0) (>= net462)) (&& (== net7.0) (< net6.0)) (== netstandard2.0) System.Collections.NonGeneric (4.3) System.Diagnostics.Debug (>= 4.3) System.Globalization (>= 4.3) @@ -50,14 +48,14 @@ NUGET Microsoft.NETCore.Platforms (>= 1.1) Microsoft.NETCore.Targets (>= 1.1) System.Runtime (>= 4.3) - System.Diagnostics.TextWriterTraceListener (4.3) + System.Diagnostics.TextWriterTraceListener (4.3) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= netcoreapp1.0)) System.Diagnostics.TraceSource (>= 4.3) System.Globalization (>= 4.3) System.IO (>= 4.3) System.Resources.ResourceManager (>= 4.3) System.Runtime (>= 4.3) System.Threading (>= 4.3) - System.Diagnostics.TraceSource (4.3) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp1.0)) + System.Diagnostics.TraceSource (4.3) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= netcoreapp1.0)) Microsoft.NETCore.Platforms (>= 1.1) runtime.native.System (>= 4.3) System.Collections (>= 4.3) @@ -77,19 +75,19 @@ NUGET System.Runtime (>= 4.3) System.Text.Encoding (>= 4.3) System.Threading.Tasks (>= 4.3) - System.Memory (4.5.5) - restriction: || (&& (== net6.0) (>= net461)) (== netstandard2.0) - System.Buffers (>= 4.5.1) - restriction: || (&& (== net6.0) (>= monotouch)) (&& (== net6.0) (>= net461)) (&& (== net6.0) (< netcoreapp2.0)) (&& (== net6.0) (< netstandard1.1)) (&& (== net6.0) (< netstandard2.0)) (&& (== net6.0) (>= xamarinios)) (&& (== net6.0) (>= xamarinmac)) (&& (== net6.0) (>= xamarintvos)) (&& (== net6.0) (>= xamarinwatchos)) (== netstandard2.0) - System.Numerics.Vectors (>= 4.4) - restriction: || (&& (== net6.0) (< netcoreapp2.0)) (== netstandard2.0) - System.Runtime.CompilerServices.Unsafe (>= 4.5.3) - restriction: || (&& (== net6.0) (>= monotouch)) (&& (== net6.0) (>= net461)) (&& (== net6.0) (< netcoreapp2.0)) (&& (== net6.0) (< netcoreapp2.1)) (&& (== net6.0) (< netstandard1.1)) (&& (== net6.0) (< netstandard2.0)) (&& (== net6.0) (>= uap10.1)) (&& (== net6.0) (>= xamarinios)) (&& (== net6.0) (>= xamarinmac)) (&& (== net6.0) (>= xamarintvos)) (&& (== net6.0) (>= xamarinwatchos)) (== netstandard2.0) - System.Numerics.Vectors (4.5) - restriction: || (&& (== net6.0) (>= net461)) (== netstandard2.0) + System.Memory (4.5.5) - restriction: || (&& (== net6.0) (>= net462)) (&& (== net7.0) (>= net462)) (&& (== net7.0) (< net6.0)) (== netstandard2.0) + System.Buffers (>= 4.5.1) - restriction: || (&& (== net6.0) (>= monotouch)) (&& (== net6.0) (>= net461)) (&& (== net6.0) (< netcoreapp2.0)) (&& (== net6.0) (< netstandard1.1)) (&& (== net6.0) (< netstandard2.0)) (&& (== net6.0) (>= xamarinios)) (&& (== net6.0) (>= xamarinmac)) (&& (== net6.0) (>= xamarintvos)) (&& (== net6.0) (>= xamarinwatchos)) (&& (== net7.0) (>= monotouch)) (&& (== net7.0) (>= net461)) (&& (== net7.0) (< netcoreapp2.0)) (&& (== net7.0) (< netstandard1.1)) (&& (== net7.0) (< netstandard2.0)) (&& (== net7.0) (>= xamarinios)) (&& (== net7.0) (>= xamarinmac)) (&& (== net7.0) (>= xamarintvos)) (&& (== net7.0) (>= xamarinwatchos)) (== netstandard2.0) + System.Numerics.Vectors (>= 4.4) - restriction: || (&& (== net6.0) (< netcoreapp2.0)) (&& (== net7.0) (< netcoreapp2.0)) (== netstandard2.0) + System.Runtime.CompilerServices.Unsafe (>= 4.5.3) - restriction: || (&& (== net6.0) (>= monotouch)) (&& (== net6.0) (>= net461)) (&& (== net6.0) (< netcoreapp2.0)) (&& (== net6.0) (< netcoreapp2.1)) (&& (== net6.0) (< netstandard1.1)) (&& (== net6.0) (< netstandard2.0)) (&& (== net6.0) (>= uap10.1)) (&& (== net6.0) (>= xamarinios)) (&& (== net6.0) (>= xamarinmac)) (&& (== net6.0) (>= xamarintvos)) (&& (== net6.0) (>= xamarinwatchos)) (&& (== net7.0) (>= monotouch)) (&& (== net7.0) (>= net461)) (&& (== net7.0) (< netcoreapp2.0)) (&& (== net7.0) (< netcoreapp2.1)) (&& (== net7.0) (< netstandard1.1)) (&& (== net7.0) (< netstandard2.0)) (&& (== net7.0) (>= uap10.1)) (&& (== net7.0) (>= xamarinios)) (&& (== net7.0) (>= xamarinmac)) (&& (== net7.0) (>= xamarintvos)) (&& (== net7.0) (>= xamarinwatchos)) (== netstandard2.0) + System.Numerics.Vectors (4.5) - restriction: || (&& (== net6.0) (>= net462)) (&& (== net7.0) (>= net462)) (&& (== net7.0) (< netcoreapp2.0)) (== netstandard2.0) System.Reflection (4.3) Microsoft.NETCore.Platforms (>= 1.1) Microsoft.NETCore.Targets (>= 1.1) System.IO (>= 4.3) System.Reflection.Primitives (>= 4.3) System.Runtime (>= 4.3) - System.Reflection.Metadata (6.0.1) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp1.0)) (&& (== netstandard2.0) (>= netcoreapp2.1)) - System.Collections.Immutable (>= 6.0) + System.Reflection.Metadata (7.0) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= netcoreapp3.1)) + System.Collections.Immutable (>= 7.0) System.Reflection.Primitives (4.3) Microsoft.NETCore.Platforms (>= 1.1) Microsoft.NETCore.Targets (>= 1.1) @@ -103,12 +101,12 @@ NUGET System.Runtime (4.3.1) Microsoft.NETCore.Platforms (>= 1.1.1) Microsoft.NETCore.Targets (>= 1.1.3) - System.Runtime.CompilerServices.Unsafe (6.0) + System.Runtime.CompilerServices.Unsafe (6.0) - restriction: || (== net6.0) (&& (== net7.0) (>= monotouch)) (&& (== net7.0) (>= net461)) (&& (== net7.0) (>= net462)) (&& (== net7.0) (< net6.0)) (&& (== net7.0) (< netcoreapp2.0)) (&& (== net7.0) (< netcoreapp2.1)) (&& (== net7.0) (< netstandard1.1)) (&& (== net7.0) (< netstandard2.0)) (&& (== net7.0) (>= uap10.1)) (== netstandard2.0) System.Runtime.Extensions (4.3.1) Microsoft.NETCore.Platforms (>= 1.1.1) Microsoft.NETCore.Targets (>= 1.1.3) System.Runtime (>= 4.3.1) - System.Text.Encoding (4.3) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp1.0)) + System.Text.Encoding (4.3) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= netcoreapp1.0)) Microsoft.NETCore.Platforms (>= 1.1) Microsoft.NETCore.Targets (>= 1.1) System.Runtime (>= 4.3) @@ -124,7 +122,7 @@ NUGET xunit.assert (>= 2.4.2) xunit.core (2.4.2) xunit.abstractions (2.0.3) - xunit.analyzers (1.0) + xunit.analyzers (1.1) xunit.assert (2.4.2) NETStandard.Library (>= 1.6.1) xunit.core (2.4.2) diff --git a/src/FsUnit.MsTestUnit/FsUnit.MsTest.fsproj b/src/FsUnit.MsTestUnit/FsUnit.MsTest.fsproj index aad23efb..fda61494 100644 --- a/src/FsUnit.MsTestUnit/FsUnit.MsTest.fsproj +++ b/src/FsUnit.MsTestUnit/FsUnit.MsTest.fsproj @@ -1,6 +1,6 @@  - net6.0;netstandard2.0 + net6.0;net7.0;netstandard2.0 FsUnit.MsTest false diff --git a/src/FsUnit.MsTestUnit/FsUnit.fs b/src/FsUnit.MsTestUnit/FsUnit.fs index 1197ac5e..93e13f63 100644 --- a/src/FsUnit.MsTestUnit/FsUnit.fs +++ b/src/FsUnit.MsTestUnit/FsUnit.fs @@ -1,9 +1,9 @@ module FsUnit.MsTest open System -open Microsoft.VisualStudio.TestTools.UnitTesting open NHamcrest open NHamcrest.Core +open Microsoft.VisualStudio.TestTools.UnitTesting let inline private assertThat(actual, matcher: IMatcher<'a>) = if not(matcher.Matches(actual)) then @@ -34,6 +34,7 @@ let inline should (f: 'a -> ^b) x (actual: obj) = let actual = match actual with | :? (unit -> unit) as assertFunc -> box assertFunc + | :? (unit -> obj) as assertFunc -> box(assertFunc >> ignore) | _ -> actual if isNull(box matcher) then diff --git a/src/FsUnit.MsTestUnit/paket.template b/src/FsUnit.MsTestUnit/paket.template index 91fbbd44..3225c1e2 100644 --- a/src/FsUnit.MsTestUnit/paket.template +++ b/src/FsUnit.MsTestUnit/paket.template @@ -14,7 +14,7 @@ licenseUrl requireLicenseAcceptance false copyright - Copyright 2012-2022 + Copyright 2012-2023 tags F# fsharp MsTest FsUnit summary @@ -23,6 +23,7 @@ description FsUnit is a set of extensions that add special testing syntax to MsTest. files ../../bin/FsUnit.MsTest/net6.0/FsUnit.* ==> lib/net6.0 + ../../bin/FsUnit.MsTest/net7.0/FsUnit.* ==> lib/net7.0 ../../bin/FsUnit.MsTest/netstandard2.0/FsUnit.* ==> lib/netstandard2.0 ../../src/install.ps1 ==> tools diff --git a/src/FsUnit.MsTestUnit/sample.paket.template b/src/FsUnit.MsTestUnit/sample.paket.template index 2bea7c64..7a5fa5e6 100644 --- a/src/FsUnit.MsTestUnit/sample.paket.template +++ b/src/FsUnit.MsTestUnit/sample.paket.template @@ -14,7 +14,7 @@ licenseUrl requireLicenseAcceptance false copyright - Copyright 2015-2022 + Copyright 2015-2023 tags F# fsharp MsTest FsUnit summary diff --git a/src/FsUnit.NUnit/FsUnit.NUnit.fsproj b/src/FsUnit.NUnit/FsUnit.NUnit.fsproj index da3689f8..3df9bf53 100644 --- a/src/FsUnit.NUnit/FsUnit.NUnit.fsproj +++ b/src/FsUnit.NUnit/FsUnit.NUnit.fsproj @@ -1,6 +1,6 @@  - net6.0;netstandard2.0 + net6.0;net7.0;netstandard2.0 FsUnit.NUnit false true diff --git a/src/FsUnit.NUnit/paket.template b/src/FsUnit.NUnit/paket.template index 6cfea915..59e2d801 100644 --- a/src/FsUnit.NUnit/paket.template +++ b/src/FsUnit.NUnit/paket.template @@ -14,7 +14,7 @@ licenseUrl requireLicenseAcceptance false copyright - Copyright 2012-2022 + Copyright 2012-2023 tags F# fsharp NUnit FsUnit summary @@ -23,6 +23,7 @@ description FsUnit is a set of extensions that add special testing syntax to NUnit. files ../../bin/FsUnit.NUnit/net6.0/FsUnit.* ==> lib/net6.0 + ../../bin/FsUnit.NUnit/net7.0/FsUnit.* ==> lib/net7.0 ../../bin/FsUnit.NUnit/netstandard2.0/FsUnit.* ==> lib/netstandard2.0 ../../src/install.ps1 ==> tools diff --git a/src/FsUnit.NUnit/sample.paket.template b/src/FsUnit.NUnit/sample.paket.template index 7f281393..b36ec3e4 100644 --- a/src/FsUnit.NUnit/sample.paket.template +++ b/src/FsUnit.NUnit/sample.paket.template @@ -14,7 +14,7 @@ licenseUrl requireLicenseAcceptance false copyright - Copyright 2015-2022 + Copyright 2015-2023 tags F# fsharp NUnit FsUnit summary diff --git a/src/FsUnit.Xunit/CustomMatchers.fs b/src/FsUnit.Xunit/CustomMatchers.fs index bf7fb4e7..e57cb0e0 100644 --- a/src/FsUnit.Xunit/CustomMatchers.fs +++ b/src/FsUnit.Xunit/CustomMatchers.fs @@ -62,13 +62,16 @@ let not'(x: obj) = let throw(t: Type) = let matches(f: obj) = - match f with - | :? (unit -> unit) as testFunc -> + let wrap testFunc = try testFunc() false with ex -> t.IsAssignableFrom(ex.GetType()) + + match f with + | :? (unit -> unit) as testFunc -> wrap testFunc + | :? (unit -> obj) as testFunc -> wrap(testFunc >> ignore) | _ -> false CustomMatcher(string t, Func<_, _> matches) diff --git a/src/FsUnit.Xunit/FsUnit.Xunit.fsproj b/src/FsUnit.Xunit/FsUnit.Xunit.fsproj index ba6afd45..d3d166c0 100644 --- a/src/FsUnit.Xunit/FsUnit.Xunit.fsproj +++ b/src/FsUnit.Xunit/FsUnit.Xunit.fsproj @@ -1,6 +1,6 @@  - net6.0;netstandard2.0 + net6.0;net7.0;netstandard2.0 FsUnit.Xunit false diff --git a/src/FsUnit.Xunit/FsUnit.fs b/src/FsUnit.Xunit/FsUnit.fs index 4abba41a..bbb22c24 100644 --- a/src/FsUnit.Xunit/FsUnit.fs +++ b/src/FsUnit.Xunit/FsUnit.fs @@ -35,6 +35,7 @@ let inline should (f: 'a -> ^b) x (actual: obj) = let actual = match actual with | :? (unit -> unit) as assertFunc -> box assertFunc + | :? (unit -> obj) as assertFunc -> box(assertFunc >> ignore) | _ -> actual if isNull(box matcher) then diff --git a/src/FsUnit.Xunit/paket.template b/src/FsUnit.Xunit/paket.template index 3f369a8a..809e1d13 100644 --- a/src/FsUnit.Xunit/paket.template +++ b/src/FsUnit.Xunit/paket.template @@ -14,7 +14,7 @@ licenseUrl requireLicenseAcceptance false copyright - Copyright 2012-2022 + Copyright 2012-2023 tags F# fsharp xUnit FsUnit summary @@ -23,6 +23,7 @@ description FsUnit is a set of extensions that add special testing syntax to xUnit. files ../../bin/FsUnit.Xunit/net6.0/FsUnit.* ==> lib/net6.0 + ../../bin/FsUnit.Xunit/net7.0/FsUnit.* ==> lib/net7.0 ../../bin/FsUnit.Xunit/netstandard2.0/FsUnit.* ==> lib/netstandard2.0 ../../src/install.ps1 ==> tools diff --git a/src/FsUnit.Xunit/sample.paket.template b/src/FsUnit.Xunit/sample.paket.template index 17d06d17..26625856 100644 --- a/src/FsUnit.Xunit/sample.paket.template +++ b/src/FsUnit.Xunit/sample.paket.template @@ -14,7 +14,7 @@ licenseUrl requireLicenseAcceptance false copyright - Copyright 2015-2022 + Copyright 2015-2023 tags F# fsharp xUnit FsUnit summary diff --git a/tests/FsUnit.MsTest.Test/FsUnit.MsTest.Test.fsproj b/tests/FsUnit.MsTest.Test/FsUnit.MsTest.Test.fsproj index 8e64e038..c0db8367 100644 --- a/tests/FsUnit.MsTest.Test/FsUnit.MsTest.Test.fsproj +++ b/tests/FsUnit.MsTest.Test/FsUnit.MsTest.Test.fsproj @@ -1,7 +1,7 @@ - net6.0 + net7.0 true diff --git a/tests/FsUnit.MsTest.Test/raiseTests.fs b/tests/FsUnit.MsTest.Test/raiseTests.fs index 1f93d4ac..8b1abb35 100644 --- a/tests/FsUnit.MsTest.Test/raiseTests.fs +++ b/tests/FsUnit.MsTest.Test/raiseTests.fs @@ -11,11 +11,16 @@ type ApplicationException(msg: string) = [] type ``raise tests``() = + [] member _.``should pass when exception of expected type is thrown``() = (fun () -> raise TestException |> ignore) |> should throw typeof + [] + member _.``should pass when exception of expected type is thrown without ignore``() = + (fun () -> raise TestException) |> should throw typeof + [] member _.``should fail when exception is not thrown``() = (fun () -> ()) |> should not' (throw typeof) @@ -74,3 +79,10 @@ type ``raise tests``() = (fun () -> raise(ApplicationException msg) |> ignore) |> should not' ((throwWithMessage msg) typeof) + + [] + member _.``should pass without ignore``() = + let msg = "BOOM!" + + (fun () -> raise(ApplicationException msg)) + |> should (throwWithMessage msg) typeof diff --git a/tests/FsUnit.MsTest.Test/shouldFailTests.fs b/tests/FsUnit.MsTest.Test/shouldFailTests.fs index 53e8ad71..d576cea8 100644 --- a/tests/FsUnit.MsTest.Test/shouldFailTests.fs +++ b/tests/FsUnit.MsTest.Test/shouldFailTests.fs @@ -32,3 +32,7 @@ type ``shouldFail tests``() = member _.``test raising exception``() = fun () -> raise(ArgumentException "help") |> should (throwWithMessage "help") typeof + + [] + member _.``Null source should fail``() = + shouldFail(fun () -> Seq.empty |> Seq.append null |> ignore) diff --git a/tests/FsUnit.NUnit.Test/FsUnit.NUnit.Test.fsproj b/tests/FsUnit.NUnit.Test/FsUnit.NUnit.Test.fsproj index e65c52a0..85b099e2 100644 --- a/tests/FsUnit.NUnit.Test/FsUnit.NUnit.Test.fsproj +++ b/tests/FsUnit.NUnit.Test/FsUnit.NUnit.Test.fsproj @@ -1,6 +1,6 @@ - net6.0 + net7.0 false diff --git a/tests/FsUnit.NUnit.Test/raiseTests.fs b/tests/FsUnit.NUnit.Test/raiseTests.fs index 38f70427..0aa369e4 100644 --- a/tests/FsUnit.NUnit.Test/raiseTests.fs +++ b/tests/FsUnit.NUnit.Test/raiseTests.fs @@ -13,8 +13,7 @@ type ApplicationException(msg: string) = type ``raise tests``() = [] member _.``should pass when exception of expected type is thrown``() = - (fun () -> raise TestException |> ignore) - |> should throw typeof + (fun () -> raise TestException) |> should throw typeof [] member _.``should fail when exception is not thrown``() = @@ -76,3 +75,8 @@ type ``raise tests``() = (fun () -> raise(ApplicationException msg) |> ignore) |> should not' ((throwWithMessage msg) typeof) + + [] + member _.``should pass without ignore``() = + (fun () -> raise(ApplicationException "BOOM!")) + |> should (throwWithMessage "BOOM!") typeof diff --git a/tests/FsUnit.NUnit.Test/shouldFailTests.fs b/tests/FsUnit.NUnit.Test/shouldFailTests.fs index 29f12556..0f0d48aa 100644 --- a/tests/FsUnit.NUnit.Test/shouldFailTests.fs +++ b/tests/FsUnit.NUnit.Test/shouldFailTests.fs @@ -20,13 +20,12 @@ type ``shouldFail tests``() = [] member _.``shouldFail should throw an exception``() = - (fun () -> shouldFail id) - |> should throw typeof + (fun () -> shouldFail id) |> should throw typeof [] member _.``shouldFail should not throw an exception when fail``() = (fun () -> shouldFail(fun () -> [] |> should contain 1)) - |> should not' (throw typeof) + |> should not' (throw typeof) [] member _.``test raising exception``() = diff --git a/tests/FsUnit.Xunit.Test/FsUnit.Xunit.Test.fsproj b/tests/FsUnit.Xunit.Test/FsUnit.Xunit.Test.fsproj index 56cbbc28..37888429 100644 --- a/tests/FsUnit.Xunit.Test/FsUnit.Xunit.Test.fsproj +++ b/tests/FsUnit.Xunit.Test/FsUnit.Xunit.Test.fsproj @@ -1,6 +1,6 @@  - net6.0 + net7.0 diff --git a/tests/FsUnit.Xunit.Test/raiseTests.fs b/tests/FsUnit.Xunit.Test/raiseTests.fs index 1bf81ea1..f0bec122 100644 --- a/tests/FsUnit.Xunit.Test/raiseTests.fs +++ b/tests/FsUnit.Xunit.Test/raiseTests.fs @@ -10,11 +10,16 @@ type ApplicationException(msg: string) = inherit Exception(msg) type ``raise tests``() = + [] member _.``should pass when exception of expected type is thrown``() = (fun () -> raise TestException |> ignore) |> should throw typeof + [] + member _.``should pass when exception of expected type is thrown without ignore``() = + (fun () -> raise TestException) |> should throw typeof + [] member _.``should fail when exception is not thrown``() = (fun () -> ()) |> should not' (throw typeof) @@ -73,3 +78,10 @@ type ``raise tests``() = (fun () -> raise(ApplicationException msg) |> ignore) |> should not' ((throwWithMessage msg) typeof) + + [] + member _.``should pass without ignore``() = + let msg = "BOOM!" + + (fun () -> raise(ApplicationException msg)) + |> should (throwWithMessage msg) typeof diff --git a/tests/FsUnit.Xunit.Test/shouldFailTests.fs b/tests/FsUnit.Xunit.Test/shouldFailTests.fs index 20ec4313..d963e771 100644 --- a/tests/FsUnit.Xunit.Test/shouldFailTests.fs +++ b/tests/FsUnit.Xunit.Test/shouldFailTests.fs @@ -31,3 +31,7 @@ type ``shouldFail tests``() = member _.``test raising exception``() = fun () -> raise(ArgumentException "help") |> should (throwWithMessage "help") typeof + + [] + member _.``Null source should fail``() = + shouldFail(fun () -> Seq.empty |> Seq.append null |> ignore)