Skip to content

Commit

Permalink
Fix new exception type MatchException -> `EqualException.ForMismatc…
Browse files Browse the repository at this point in the history
…hedValues`, thanks XUnit for making incompatible changes without first deprecating types

See fsprojects/FsUnit#240 for the FsUnit change (2nd commit) and fsprojects/FsUnit#251, and https://xunit.net/releases/v2/2.5.0
  • Loading branch information
abelbraaksma committed Oct 28, 2023
1 parent a98a4a2 commit a115156
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/FSharp.Control.TaskSeq.Test/Nunit.Extensions.fs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ module ExtraCustomMatchers =
let private baseResultTypeTest value =
match value with
| null ->
MatchException("Result type", "<null>", "Value <null> or None is never Result.Ok or Result.Error")
EqualException.ForMismatchedValues(
"Result type",
"<null>",
"Value <null> or None is never Result.Ok or Result.Error"
)
|> raise

| _ ->
Expand All @@ -31,7 +35,7 @@ module ExtraCustomMatchers =
if ty.FullName.StartsWith "Microsoft.FSharp.Core.FSharpResult" then
FSharpValue.GetUnionFields(value, ty) |> fst
else
MatchException("Result type", ty.Name, "Type must be Result<_, _>")
EqualException.ForMismatchedValues("Result type", ty.Name, "Type must be Result<_, _>")
|> raise

let private baseOptionTypeTest value =
Expand All @@ -49,9 +53,13 @@ module ExtraCustomMatchers =
| "None" -> None
| _ ->
raise
<| MatchException("Option type", ty.Name, "Unexpected field name for F# option type")
<| EqualException.ForMismatchedValues(
"Option type",
ty.Name,
"Unexpected field name for F# option type"
)
else
MatchException("Option type", ty.Name, "Type must be Option<_>")
EqualException.ForMismatchedValues("Option type", ty.Name, "Type must be Option<_>")
|> raise


Expand Down

0 comments on commit a115156

Please sign in to comment.