Skip to content

Commit

Permalink
Merge pull request #240 from CaptnCodr/dependencies
Browse files Browse the repository at this point in the history
Update dependencies.
  • Loading branch information
CaptnCodr authored Jul 11, 2023
2 parents ab9464b + c52729b commit e59e43f
Show file tree
Hide file tree
Showing 10 changed files with 63 additions and 68 deletions.
48 changes: 24 additions & 24 deletions paket.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ RESTRICTION: || (== net6.0) (== netstandard2.0)
NUGET
remote: https://api.nuget.org/v3/index.json
FSharp.Core (5.0.2)
Microsoft.CodeCoverage (17.6.2) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= net462)) (&& (== netstandard2.0) (>= netcoreapp3.1))
Microsoft.NET.Test.Sdk (17.6.2)
Microsoft.CodeCoverage (>= 17.6.2) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= net462)) (&& (== netstandard2.0) (>= netcoreapp3.1))
Microsoft.TestPlatform.TestHost (>= 17.6.2) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp3.1))
Microsoft.NETCore.Platforms (7.0.2)
Microsoft.CodeCoverage (17.6.3) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= net462)) (&& (== netstandard2.0) (>= netcoreapp3.1))
Microsoft.NET.Test.Sdk (17.6.3)
Microsoft.CodeCoverage (>= 17.6.3) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= net462)) (&& (== netstandard2.0) (>= netcoreapp3.1))
Microsoft.TestPlatform.TestHost (>= 17.6.3) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp3.1))
Microsoft.NETCore.Platforms (7.0.3)
Microsoft.NETCore.Targets (5.0)
Microsoft.TestPlatform.ObjectModel (17.6.2) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp3.1))
Microsoft.TestPlatform.ObjectModel (17.6.3) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp3.1))
NuGet.Frameworks (>= 6.5)
System.Reflection.Metadata (>= 1.6)
Microsoft.TestPlatform.TestHost (17.6.2) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp3.1))
Microsoft.TestPlatform.ObjectModel (>= 17.6.2) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp3.1))
Microsoft.TestPlatform.TestHost (17.6.3) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp3.1))
Microsoft.TestPlatform.ObjectModel (>= 17.6.3) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp3.1))
Newtonsoft.Json (>= 13.0.1) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp3.1))
MSTest.TestAdapter (2.1.2)
NETStandard.Library (>= 1.6.1) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp1.0))
Expand All @@ -21,8 +21,8 @@ NUGET
NETStandard.Library (2.0.3)
Microsoft.NETCore.Platforms (>= 1.1)
Newtonsoft.Json (13.0.3) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp3.1))
NHamcrest (3.1)
NuGet.Frameworks (6.6) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp3.1))
NHamcrest (3.3)
NuGet.Frameworks (6.6.1) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp3.1))
NUnit (3.13.3)
NETStandard.Library (>= 2.0)
NUnit3TestAdapter (4.5)
Expand Down Expand Up @@ -86,7 +86,7 @@ NUGET
System.IO (>= 4.3)
System.Reflection.Primitives (>= 4.3)
System.Runtime (>= 4.3)
System.Reflection.Metadata (7.0.1) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp3.1))
System.Reflection.Metadata (7.0.2) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp3.1))
System.Collections.Immutable (>= 7.0)
System.Reflection.Primitives (4.3)
Microsoft.NETCore.Platforms (>= 1.1)
Expand Down Expand Up @@ -117,21 +117,21 @@ NUGET
Microsoft.NETCore.Platforms (>= 1.1)
Microsoft.NETCore.Targets (>= 1.1)
System.Runtime (>= 4.3)
xunit (2.4.2)
xunit.analyzers (>= 1.0)
xunit.assert (>= 2.4.2)
xunit.core (2.4.2)
xunit (2.5)
xunit.analyzers (>= 1.2)
xunit.assert (>= 2.5)
xunit.core (2.5)
xunit.abstractions (2.0.3)
xunit.analyzers (1.1)
xunit.assert (2.4.2)
xunit.analyzers (1.2)
xunit.assert (2.5)
NETStandard.Library (>= 1.6.1)
xunit.core (2.4.2)
xunit.extensibility.core (2.4.2)
xunit.extensibility.execution (2.4.2)
xunit.extensibility.core (2.4.2)
xunit.core (2.5)
xunit.extensibility.core (2.5)
xunit.extensibility.execution (2.5)
xunit.extensibility.core (2.5)
NETStandard.Library (>= 1.6.1)
xunit.abstractions (>= 2.0.3)
xunit.extensibility.execution (2.4.2)
xunit.extensibility.execution (2.5)
NETStandard.Library (>= 1.6.1)
xunit.extensibility.core (2.4.2)
xunit.runner.visualstudio (2.4.5)
xunit.extensibility.core (2.5)
xunit.runner.visualstudio (2.5)
13 changes: 5 additions & 8 deletions src/FsUnit.Xunit/FsUnit.fs
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,15 @@ open Xunit.Sdk
open NHamcrest
open NHamcrest.Core

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()
matcher.DescribeTo(description)

let raiseMatchException(value: string) =
raise(MatchException(description.ToString(), value, null))
let raiseEqualException(value: string) =
raise(EqualException.ForMismatchedValues(description.ToString(), value))

match box actual with
| :? (unit -> unit) as actualfunc ->
Expand All @@ -26,8 +23,8 @@ type Xunit.Assert with
String.Empty
with ex ->
ex.ToString())
|> raiseMatchException
| _ -> $"%A{actual}" |> raiseMatchException
|> raiseEqualException
| _ -> $"%A{actual}" |> raiseEqualException

let inline should (f: 'a -> ^b) x (actual: obj) =
let matcher = f x
Expand All @@ -52,7 +49,7 @@ let inline shouldFail(f: unit -> unit) =
true

if not failed then
raise(MatchException("Method should fail", "No exception raised", null))
raise(ThrowsException.ForNoException(f.GetType()))

let equalSeq expected =
CustomMatchers.equalSeq (fun (e: seq<'a>) (a: seq<'a>) -> Assert.Equal<seq<'a>>(e, a)) expected
Expand Down
7 changes: 3 additions & 4 deletions tests/FsUnit.Xunit.Test/beGreaterThanTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ namespace FsUnit.Test

open Xunit
open FsUnit.Xunit
open Xunit.Sdk

type ``be greaterThan tests``() =
[<Fact>]
Expand All @@ -25,8 +26,6 @@ type ``be greaterThan tests``() =
9.2 |> should not' (be greaterThan 9.2)

[<Fact>]
member _.``10 should not be greater than 10 but messages should equal``() =
member _.``10 should not be greater than 10 and should throw EqualException``() =
(fun () -> 10 |> should be (greaterThan 10))
|> fun f -> Assert.Throws<MatchException>(f)
|> fun e -> (e.Expected, e.Actual)
|> should equal ("Greater than 10", "10")
|> should throw typeof<EqualException>
13 changes: 4 additions & 9 deletions tests/FsUnit.Xunit.Test/beSubsetOfTests.fs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
namespace FsUnit.Test

open Xunit
open Xunit.Sdk
open FsUnit.Xunit
open FsUnitTyped

type ``be subsetOf tests``() =

Expand Down Expand Up @@ -34,12 +36,5 @@ type ``be subsetOf tests``() =
[ 1..10 ] |> should be (subsetOf [ 1..10 ])

[<Fact>]
member _.``should fail on '1 to 11 should be subset of 1 to 10'``() =
shouldFail(fun () -> [ 1..11 ] |> should be (subsetOf [ 1..10 ]))

[<Fact>]
member _.``11 should not be subset of 1 to 10 but messages should equal``() =
(fun _ -> [ 11 ] |> should be (subsetOf [ 1..10 ]))
|> fun f -> Assert.Throws<MatchException>(f)
|> fun e -> (e.Expected, e.Actual)
|> should equal ("Is subset of [1; 2; 3; 4; 5; 6; 7; 8; 9; 10]", "[11]")
member _.``should fail on '1 to 11 should be subset of 1 to 10' and check if it's EqualException``() =
shouldFail<EqualException>(fun () -> [ 1..11 ] |> should be (subsetOf [ 1..10 ]))
7 changes: 3 additions & 4 deletions tests/FsUnit.Xunit.Test/equalTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ open System
open System.Collections.Immutable

open Xunit
open Xunit.Sdk
open FsUnit.Xunit

type AlwaysEqual() =
Expand Down Expand Up @@ -106,11 +107,9 @@ type ``equal Tests``() =
anImmutableArray |> should not' (equal otherImmutableArray)

[<Fact>]
member _.``Ok "foo" should fail on equal Ok "bar" but message should be equal``() =
member _.``Ok "foo" should fail on equal Ok "bar" and should throw EqualException``() =
(fun () -> Ok "foo" |> should equal (Ok "bar"))
|> fun f -> Assert.Throws<MatchException>(f)
|> fun e -> (e.Expected, e.Actual)
|> should equal ("Equals Ok \"bar\"", "Ok \"foo\"")
|> should throw typeof<EqualException>

[<Fact>]
member _.``structural comparable type containing non-equivalent structural equatable type fails with correct exception``() =
Expand Down
7 changes: 3 additions & 4 deletions tests/FsUnit.Xunit.Test/haveLengthTests.fs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
namespace FsUnit.Test

open Xunit
open Xunit.Sdk
open FsUnit.Xunit

type ``haveLength tests``() =
Expand Down Expand Up @@ -39,11 +40,9 @@ type ``haveLength tests``() =
shouldFail(fun () -> [| 1 |] |> should not' (haveLength 1))

[<Fact>]
member _.``Array with 1 item should fail to have Length 2 but messages should equal``() =
member _.``Array with 1 item should fail to have Length 2 and should throw EqualException``() =
(fun () -> [| 1 |] |> should haveLength 2)
|> fun f -> Assert.Throws<MatchException>(f)
|> fun e -> (e.Expected, e.Actual)
|> should equal ("Have Length 2", "[|1|]")
|> should throw typeof<EqualException>

// Seq
[<Fact>]
Expand Down
12 changes: 9 additions & 3 deletions tests/FsUnit.Xunit.Test/shouldFailTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ namespace FsUnit.Test
open System
open Xunit
open FsUnit.Xunit
open Xunit.Sdk

type ``shouldFail tests``() =

Expand All @@ -20,12 +21,17 @@ type ``shouldFail tests``() =

[<Fact>]
member _.``shouldFail should throw an exception``() =
(fun () -> shouldFail id) |> should throw typeof<MatchException>
(fun () -> shouldFail id) |> should throw typeof<ThrowsException>

[<Fact>]
member _.``shouldFail should not throw an exception when fail``() =
member _.``shouldFail should not throw an exception when fail with ThrowsException``() =
(fun () -> shouldFail(fun () -> [] |> should contain 1))
|> should not' (throw typeof<MatchException>)
|> should not' (throw typeof<ThrowsException>)

[<Fact>]
member _.``shouldFail should not throw an exception when fail with EqualException``() =
(fun () -> shouldFail(fun () -> [] |> should contain 1))
|> should not' (throw typeof<EqualException>)

[<Fact>]
member _.``test raising exception``() =
Expand Down
9 changes: 4 additions & 5 deletions tests/FsUnit.Xunit.Test/shouldStartWithTests.fs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
namespace FsUnit.Test

open Xunit
open Xunit.Sdk
open FsUnit.Xunit
open FsUnitTyped

type ``should startWith tests``() =
[<Fact>]
Expand All @@ -17,8 +19,5 @@ type ``should startWith tests``() =
"ships" |> should not' (startWith "ss")

[<Fact>]
member _.``ships should not start with ss but messages should equal``() =
(fun _ -> "ships" |> should startWith "ss")
|> fun f -> Assert.Throws<MatchException>(f)
|> fun e -> (e.Expected, e.Actual)
|> should equal ("ss", "\"ships\"")
member _.``ships should not start with ss and check if it's EqualException``() =
shouldFail<EqualException>(fun _ -> "ships" |> should startWith "ss")
6 changes: 3 additions & 3 deletions tests/FsUnit.Xunit.Test/typed.shouldBeSmallerThanTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ namespace FsUnit.Typed.Test

open FsUnit.Xunit
open Xunit
open Xunit.Sdk
open FsUnitTyped

type ``shouldBeSmallerThan tests``() =
Expand All @@ -11,7 +12,7 @@ type ``shouldBeSmallerThan tests``() =

[<Fact>]
member _.``10 should not be less than 10``() =
(fun () -> 10 |> shouldBeSmallerThan 10) |> shouldFail<MatchException>
(fun () -> 10 |> shouldBeSmallerThan 10) |> shouldFail<EqualException>

[<Fact>]
member _.``10[dot]0 should be less than 10[dot]1``() =
Expand All @@ -20,5 +21,4 @@ type ``shouldBeSmallerThan tests``() =
[<Fact>]
member _.``10[dot]0 should not be less than 10[dot]0``() =
(fun () -> 10.0 |> shouldBeSmallerThan 10.0)
|> should throw typeof<MatchException>
//|> shouldFail<MatchException>
|> should throw typeof<EqualException>
9 changes: 5 additions & 4 deletions tests/FsUnit.Xunit.Test/typed.shouldEqualTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ open System.Collections.Immutable

open FsUnit.Xunit
open Xunit
open Xunit.Sdk
open FsUnitTyped
open System

Expand Down Expand Up @@ -81,12 +82,12 @@ type ``shouldEqual Tests``() =
[<Fact>]
member _.``Error "Foo" should equal fails and have same message``() =
(fun () -> Error "Foo" |> shouldEqual(Error "Bar"))
|> Assert.Throws<MatchException>
|> Assert.Throws<EqualException>
|> fun e ->
e.Message
|> shouldEqual(
sprintf
"Exception of type 'FsUnit.Xunit+MatchException' was thrown.%sExpected: Equals Error \"Bar\"%sActual: Error \"Foo\""
"Assert.Equal() Failure: Values differ%sExpected: Equals Error \"Bar\"%sActual: Error \"Foo\""
Environment.NewLine
Environment.NewLine
)
Expand All @@ -98,12 +99,12 @@ type ``shouldEqual Tests``() =
[<Fact>]
member _.``Error "Foo" should not equal Error "Bar" fails and have same message``() =
(fun () -> Error "Foo" |> shouldNotEqual(Error "Foo"))
|> Assert.Throws<MatchException>
|> Assert.Throws<EqualException>
|> fun e ->
e.Message
|> shouldEqual(
sprintf
"Exception of type 'FsUnit.Xunit+MatchException' was thrown.%sExpected: not Equals Error \"Foo\"%sActual: Error \"Foo\""
"Assert.Equal() Failure: Values differ%sExpected: not Equals Error \"Foo\"%sActual: Error \"Foo\""
Environment.NewLine
Environment.NewLine
)
Expand Down

0 comments on commit e59e43f

Please sign in to comment.