Skip to content

Commit

Permalink
revert #1112 (#1116)
Browse files Browse the repository at this point in the history
* revert #1112

https://github.com/etorreborre/specs2/pull/1112/files
This causes beEqualTo usages with vague types to fail compilation.

* added a test

* fix formatting

* fix formatting 2

* fix compilation

* CR

* format

* small fix
  • Loading branch information
dekelatwix authored Nov 3, 2022
1 parent 76e79ac commit bbf99b7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ class BeFalseMatcher extends Matcher[Boolean]:

/** Equality Matcher
*/
class BeEqualTo[T](t: =>T) extends EqualityMatcher(t)
class BeEqualTo(t: =>Any) extends EqualityMatcher(t)

/** This matcher always matches any value of type T
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ class BeEqualToMatcherSpec extends Spec with ResultMatchers with ShouldMatchers
${"a" must be_!=("b")}
${"a" must not(be_!=("a"))}

Distinguish between typed and non typed equality matchers
${A must be_==("a")}
Will not compile: {A must not be_===("a")}

Array equality uses deep array comparison, with or without typed equality
${Array(1, 2) must be_==(Array(1, 2))}
${Array(1, 2) must be_==(Array(1, 2))}
Expand Down Expand Up @@ -122,3 +126,7 @@ Details
}

case class Hello() { override def toString = "hello" }

object A {
override def equals(that: Any) = that == "a"
}

0 comments on commit bbf99b7

Please sign in to comment.