diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json
index bf177d8e..77569208 100644
--- a/.config/dotnet-tools.json
+++ b/.config/dotnet-tools.json
@@ -15,13 +15,13 @@
]
},
"fsdocs-tool": {
- "version": "15.0.1",
+ "version": "16.1.1",
"commands": [
"fsdocs"
]
},
- "fantomas-tool": {
- "version": "4.7.9",
+ "fantomas": {
+ "version": "5.0.0",
"commands": [
"fantomas"
]
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 70405dd5..9a4079a3 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -15,7 +15,7 @@ jobs:
fail-fast: false
matrix:
os: [windows-latest, macOS-latest, ubuntu-latest]
- dotnet: [6.0.400]
+ dotnet: [6.0.401]
runs-on: ${{ matrix.os }}
steps:
diff --git a/global.json b/global.json
index 510ef93b..44752d33 100644
--- a/global.json
+++ b/global.json
@@ -1,6 +1,6 @@
{
"sdk": {
- "version": "6.0.400",
+ "version": "6.0.401",
"rollForward": "minor"
}
}
\ No newline at end of file
diff --git a/src/FsUnit.MsTestUnit/FsUnit.fs b/src/FsUnit.MsTestUnit/FsUnit.fs
index 9797efac..ddf441cb 100644
--- a/src/FsUnit.MsTestUnit/FsUnit.fs
+++ b/src/FsUnit.MsTestUnit/FsUnit.fs
@@ -18,12 +18,13 @@ let inline private assertThat(actual, matcher: IMatcher<'a>) =
(try
actualfunc()
String.Empty
- with
- | ex -> ex.ToString())
+ with ex ->
+ ex.ToString())
|> raiseAssertFailedException
| _ -> actual |> raiseAssertFailedException
type Assert with
+
static member That<'a>(actual, matcher: IMatcher<'a>) =
assertThat(actual, matcher)
@@ -45,8 +46,8 @@ let inline shouldFail(f: unit -> unit) =
try
f()
false
- with
- | _ -> true
+ with _ ->
+ true
if not failed then
raise(AssertFailedException("Method should fail"))
diff --git a/src/FsUnit.NUnit/Equality.fs b/src/FsUnit.NUnit/Equality.fs
index d698868d..0b5dcfdd 100644
--- a/src/FsUnit.NUnit/Equality.fs
+++ b/src/FsUnit.NUnit/Equality.fs
@@ -20,16 +20,8 @@ type Equality<'T when 'T: equality> =
static member inline IsEqualTo(x: 'T) =
match (box x) with
- | :? IStructuralEquatable ->
- Is
- .EqualTo(x)
- .Or.EqualTo(x)
- .Using<'T>(Equality.Structural)
- | :? IStructuralComparable ->
- Is
- .EqualTo(x)
- .Or.EqualTo(x)
- .Using<'T>(Equality.StructuralC)
+ | :? IStructuralEquatable -> Is.EqualTo(x).Or.EqualTo(x).Using<'T>(Equality.Structural)
+ | :? IStructuralComparable -> Is.EqualTo(x).Or.EqualTo(x).Using<'T>(Equality.StructuralC)
| _ -> Is.EqualTo(x)
static member IsNotEqualTo(x: 'T) =
diff --git a/src/FsUnit.NUnit/GenericAssert.fs b/src/FsUnit.NUnit/GenericAssert.fs
index ea80ed93..6db8e354 100644
--- a/src/FsUnit.NUnit/GenericAssert.fs
+++ b/src/FsUnit.NUnit/GenericAssert.fs
@@ -38,7 +38,7 @@ type Assert =
/// The actual value.
/// The message to display in case of failure.
/// Array of objects to be used in formatting the message.
- static member AreEqual<'T when 'T: equality>(expected: 'T, actual: 'T, message: string, [] args: obj []) : unit =
+ static member AreEqual<'T when 'T: equality>(expected: 'T, actual: 'T, message: string, [] args: obj[]) : unit =
let eqConstraint = Equality.IsEqualTo(expected)
Assert.That(actual, eqConstraint, message, args)
@@ -71,7 +71,7 @@ type Assert =
/// The actual value.
/// The message to display in case of failure.
/// Array of objects to be used in formatting the message.
- static member AreNotEqual<'T when 'T: equality>(expected: 'T, actual: 'T, message: string, [] args: obj []) : unit =
+ static member AreNotEqual<'T when 'T: equality>(expected: 'T, actual: 'T, message: string, [] args: obj[]) : unit =
let neqConstraint = Equality.IsNotEqualTo(expected)
Assert.That(actual, neqConstraint, message, args)
@@ -104,7 +104,7 @@ type Assert =
/// The actual object.
/// The message to display in case of failure.
/// Array of objects to be used in formatting the message.
- static member AreNotSame<'T when 'T: not struct>(expected: 'T, actual: 'T, message: string, [] args: obj []) : unit =
+ static member AreNotSame<'T when 'T: not struct>(expected: 'T, actual: 'T, message: string, [] args: obj[]) : unit =
let sameConstraint = Is.Not.SameAs expected
Assert.That(actual, sameConstraint, message, args)
@@ -137,7 +137,7 @@ type Assert =
/// The actual object.
/// The message to display in case of failure.
/// Array of objects to be used in formatting the message.
- static member AreSame<'T when 'T: not struct>(expected: 'T, actual: 'T, message: string, [] args: obj []) : unit =
+ static member AreSame<'T when 'T: not struct>(expected: 'T, actual: 'T, message: string, [] args: obj[]) : unit =
let sameConstraint = Is.SameAs expected
Assert.That(actual, sameConstraint, message, args)
@@ -169,7 +169,7 @@ type Assert =
/// The list to be examined.
/// The message to display in case of failure.
/// Array of objects to be used in formatting the message.
- static member Contains<'T when 'T: equality>(expected: 'T, actual: IEnumerable<'T>, message: string, [] args: obj []) : unit =
+ static member Contains<'T when 'T: equality>(expected: 'T, actual: IEnumerable<'T>, message: string, [] args: obj[]) : unit =
let eqConstraint = Equality.IsEqualTo(expected)
let containsConstraint = SomeItemsConstraint(eqConstraint)
Assert.That(actual, containsConstraint, message, args)
@@ -201,7 +201,7 @@ type Assert =
/// The second value, expected to be less.
/// The message to display in case of failure.
/// Array of objects to be used in formatting the message.
- static member Greater<'T when 'T: comparison>(arg1: 'T, arg2: 'T, message: string, [] args: obj []) : unit =
+ static member Greater<'T when 'T: comparison>(arg1: 'T, arg2: 'T, message: string, [] args: obj[]) : unit =
Assert.That(arg1, Is.GreaterThan arg2, message, args)
///
@@ -231,7 +231,7 @@ type Assert =
/// The second value, expected to be less.
/// The message to display in case of failure.
/// Array of objects to be used in formatting the message.
- static member GreaterOrEqual<'T when 'T: comparison>(arg1: 'T, arg2: 'T, message: string, [] args: obj []) : unit =
+ static member GreaterOrEqual<'T when 'T: comparison>(arg1: 'T, arg2: 'T, message: string, [] args: obj[]) : unit =
Assert.That(arg1, Is.GreaterThanOrEqualTo arg2, message, args)
///
@@ -261,7 +261,7 @@ type Assert =
/// The second value, expected to be greater.
/// The message to display in case of failure.
/// Array of objects to be used in formatting the message.
- static member Less<'T when 'T: comparison>(arg1: 'T, arg2: 'T, message: string, [] args: obj []) : unit =
+ static member Less<'T when 'T: comparison>(arg1: 'T, arg2: 'T, message: string, [] args: obj[]) : unit =
Assert.That(arg1, Is.LessThan arg2, message, args)
///
@@ -291,7 +291,7 @@ type Assert =
/// The second value, expected to be greater.
/// The message to display in case of failure.
/// Array of objects to be used in formatting the message.
- static member LessOrEqual<'T when 'T: comparison>(arg1: 'T, arg2: 'T, message: string, [] args: obj []) : unit =
+ static member LessOrEqual<'T when 'T: comparison>(arg1: 'T, arg2: 'T, message: string, [] args: obj[]) : unit =
Assert.That(arg1, Is.LessThanOrEqualTo arg2, message, args)
///
@@ -318,7 +318,7 @@ type Assert =
/// The object that is to be tested.
/// The message to display in case of failure.
/// Array of objects to be used in formatting the message.
- static member NotNull<'T when 'T: not struct>(arg: 'T, message: string, [] args: obj []) : unit =
+ static member NotNull<'T when 'T: not struct>(arg: 'T, message: string, [] args: obj[]) : unit =
Assert.That(arg, Is.Not.Null, message, args)
///
@@ -345,5 +345,5 @@ type Assert =
/// The object that is to be tested.
/// The message to display in case of failure.
/// Array of objects to be used in formatting the message.
- static member Null<'T when 'T: not struct>(arg: 'T, message: string, [] args: obj []) : unit =
+ static member Null<'T when 'T: not struct>(arg: 'T, message: string, [] args: obj[]) : unit =
Assert.That(arg, Is.Null, message, args)
diff --git a/src/FsUnit.Xunit/CustomMatchers.fs b/src/FsUnit.Xunit/CustomMatchers.fs
index 371a31e2..a62faa20 100644
--- a/src/FsUnit.Xunit/CustomMatchers.fs
+++ b/src/FsUnit.Xunit/CustomMatchers.fs
@@ -21,8 +21,8 @@ let equivalent f expected =
f (toCollection expected) (toCollection e)
true
| _ -> false
- with
- | _ -> false
+ with _ ->
+ false
CustomMatcher($"Equivalent to %A{expected}", Func<_, _> matches)
@@ -57,8 +57,8 @@ let throw(t: Type) =
try
testFunc()
false
- with
- | ex -> t.IsAssignableFrom(ex.GetType())
+ with ex ->
+ t.IsAssignableFrom(ex.GetType())
| _ -> false
CustomMatcher(string t, Func<_, _> matches)
@@ -70,8 +70,8 @@ let throwWithMessage (m: string) (t: Type) =
try
testFunc()
false
- with
- | ex -> ex.GetType() = t && ex.Message = m
+ with ex ->
+ ex.GetType() = t && ex.Message = m
| _ -> false
CustomMatcher($"{string t} \"{m}\"", Func<_, _> matches)
@@ -298,8 +298,8 @@ type ChoiceDiscriminator(n: int) =
this.GetType().GetMethods()
|> Seq.filter(fun m -> m.Name = "check" && Seq.length(m.GetGenericArguments()) = cArgCount)
|> Seq.exists(fun m -> m.MakeGenericMethod(cArgs).Invoke(this, [| c |]) :?> bool)
- with
- | _ -> false
+ with _ ->
+ false
let choice n =
CustomMatcher($"The choice %d{n}", (fun x -> (ChoiceDiscriminator(n)).check(x)))
diff --git a/src/FsUnit.Xunit/FsUnit.fs b/src/FsUnit.Xunit/FsUnit.fs
index 5fbe9935..792b44cc 100644
--- a/src/FsUnit.Xunit/FsUnit.fs
+++ b/src/FsUnit.Xunit/FsUnit.fs
@@ -10,6 +10,7 @@ type MatchException(expected, actual, userMessage) =
inherit AssertActualExpectedException(expected, actual, userMessage)
type Xunit.Assert with
+
static member That<'a>(actual, matcher: IMatcher<'a>) =
if not(matcher.Matches(actual)) then
let description = StringDescription()
@@ -23,8 +24,8 @@ type Xunit.Assert with
(try
actualfunc()
String.Empty
- with
- | ex -> ex.ToString())
+ with ex ->
+ ex.ToString())
|> raiseMatchException
| _ -> $"%A{actual}" |> raiseMatchException
@@ -46,8 +47,8 @@ let inline shouldFail(f: unit -> unit) =
try
f()
false
- with
- | _ -> true
+ with _ ->
+ true
if not failed then
raise(MatchException("Method should fail", "No exception raised", null))
diff --git a/tests/FsUnit.MsTest.Test/raiseTests.fs b/tests/FsUnit.MsTest.Test/raiseTests.fs
index f04a4e1f..1f93d4ac 100644
--- a/tests/FsUnit.MsTest.Test/raiseTests.fs
+++ b/tests/FsUnit.MsTest.Test/raiseTests.fs
@@ -43,13 +43,13 @@ type ``raise tests``() =
[]
member _.``should fail when exception of expected type with unexpected message is thrown``() =
- shouldFail (fun () ->
+ shouldFail(fun () ->
(fun () -> raise(ApplicationException "BOOM!") |> ignore)
|> should (throwWithMessage "CRASH!") typeof)
[]
member _.``should fail when exception of unexpected type with expected message is thrown``() =
- shouldFail (fun () ->
+ shouldFail(fun () ->
let msg = "BOOM!"
(fun () -> raise(ApplicationException msg) |> ignore)
@@ -57,7 +57,7 @@ type ``raise tests``() =
[]
member _.``should fail when negated and exception of expected type with expected message is thrown``() =
- shouldFail (fun () ->
+ shouldFail(fun () ->
let msg = "BOOM!"
(fun () -> raise(ApplicationException msg) |> ignore)
diff --git a/tests/FsUnit.NUnit.Test/raiseTests.fs b/tests/FsUnit.NUnit.Test/raiseTests.fs
index 31a97f9a..38f70427 100644
--- a/tests/FsUnit.NUnit.Test/raiseTests.fs
+++ b/tests/FsUnit.NUnit.Test/raiseTests.fs
@@ -26,13 +26,13 @@ type ``raise tests``() =
[]
member _.``should fail when negated and exception is thrown``() =
- shouldFail (fun () ->
+ shouldFail(fun () ->
(fun () -> raise TestException |> ignore)
|> should not' (throw typeof))
[]
member _.``should fail when exception thrown is not the type expected``() =
- shouldFail (fun () ->
+ shouldFail(fun () ->
(fun () -> raise TestException |> ignore)
|> should throw typeof)
@@ -45,13 +45,13 @@ type ``raise tests``() =
[]
member _.``should fail when exception of expected type with unexpected message is thrown``() =
- shouldFail (fun () ->
+ shouldFail(fun () ->
(fun () -> raise(ApplicationException "BOOM!") |> ignore)
|> should (throwWithMessage "CRASH!") typeof)
[]
member _.``should fail when exception of unexpected type with expected message is thrown``() =
- shouldFail (fun () ->
+ shouldFail(fun () ->
let msg = "BOOM!"
(fun () -> raise(ApplicationException msg) |> ignore)
@@ -59,7 +59,7 @@ type ``raise tests``() =
[]
member _.``should fail when negated and exception of expected type with expected message is thrown``() =
- shouldFail (fun () ->
+ shouldFail(fun () ->
let msg = "BOOM!"
(fun () -> raise(ApplicationException msg) |> ignore)
diff --git a/tests/FsUnit.Xunit.Test/raiseTests.fs b/tests/FsUnit.Xunit.Test/raiseTests.fs
index 1c8990e9..1bf81ea1 100644
--- a/tests/FsUnit.Xunit.Test/raiseTests.fs
+++ b/tests/FsUnit.Xunit.Test/raiseTests.fs
@@ -42,13 +42,13 @@ type ``raise tests``() =
[]
member _.``should fail when exception of expected type with unexpected message is thrown``() =
- shouldFail (fun () ->
+ shouldFail(fun () ->
(fun () -> raise(ApplicationException "BOOM!") |> ignore)
|> should (throwWithMessage "CRASH!") typeof)
[]
member _.``should fail when exception of unexpected type with expected message is thrown``() =
- shouldFail (fun () ->
+ shouldFail(fun () ->
let msg = "BOOM!"
(fun () -> raise(ApplicationException msg) |> ignore)
@@ -56,7 +56,7 @@ type ``raise tests``() =
[]
member _.``should fail when negated and exception of expected type with expected message is thrown``() =
- shouldFail (fun () ->
+ shouldFail(fun () ->
let msg = "BOOM!"
(fun () -> raise(ApplicationException msg) |> ignore)