Skip to content

Commit

Permalink
Push tests that demonstrate inconsistency
Browse files Browse the repository at this point in the history
  • Loading branch information
Smaug123 committed Apr 3, 2022
1 parent c01985f commit 70e3c4b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/FsUnit.Xunit/FsUnitTyped.fs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ open FsUnit.Xunit
module TopLevelOperators =

/// Asserts that `expected` is equal to `actual`.
/// The equality instance on `expected` is used.
/// The equality instance on `expected` is used, if available.
[<DebuggerStepThrough>]
let shouldEqual<'a> (expected: 'a) (actual: 'a) =
should equal actual expected
should equal expected actual

/// Asserts that `expected` is not equal to `actual`.
/// The equality instance on `expected` is used.
/// The equality instance on `expected` is used, if available.
[<DebuggerStepThrough>]
let shouldNotEqual<'a> (expected: 'a) (actual: 'a) =
should not' (equal actual) expected
Expand Down
8 changes: 8 additions & 0 deletions tests/FsUnit.Xunit.Test/equalTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ type ``equal Tests``() =
member __.``reference type should fail to not equal itself``() =
anObj |> should equal anObj

[<Fact>]
member __.``should pass when Equals returns true``() =
anObj |> should equal (box(new AlwaysEqual()))

[<Fact>]
member __.``should fail when Equals returns false``() =
anObj |> should not' (equal(NeverEqual()))
Expand All @@ -69,6 +73,10 @@ type ``equal Tests``() =
member __.``should pass when negated and Equals returns false``() =
anObj |> should not' (equal(NeverEqual()))

[<Fact>]
member __.``should fail when negated and Equals returns true``() =
shouldFail(fun () -> anObj |> should not' (equal(box(new AlwaysEqual()))))

[<Fact>]
member __.``should pass when comparing two lists that have the same values``() =
[ 1 ] |> should equal [ 1 ]
Expand Down

0 comments on commit 70e3c4b

Please sign in to comment.