Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix these type constraints (rafl)

  • Loading branch information...
commit 7d8bf9f5b6952c39650be00a1e8bd7f1d950c681 1 parent 7c24b8e
@doy authored
Showing with 8 additions and 4 deletions.
  1. +8 −4 src/main/scala/com/iinteractive/test/TestMore.scala
View
12 src/main/scala/com/iinteractive/test/TestMore.scala
@@ -216,7 +216,7 @@ class TestMore (plan: Plan = NoPlan) extends Test with DelayedInit {
*
* @example `is(response.status, 200)`
*/
- def is[T] (got: T, expected: T): Boolean =
+ def is[T, U] (got: T, expected: U)(implicit e: U <:< T): Boolean =
test(got == expected, isMessage(got, expected))
/** Assert that two objects are equal (using `==`), and describe the
@@ -224,14 +224,16 @@ class TestMore (plan: Plan = NoPlan) extends Test with DelayedInit {
*
* @example `is(response.status, 200, "we got a 200 OK response")`
*/
- def is[T] (got: T, expected: T, desc: String): Boolean =
+ def is[T, U] (got: T, expected: U, desc: String)(
+ implicit e: U <:< T
+ ): Boolean =
testWithDesc(got == expected, desc, isMessage(got, expected))
/** Assert that two objects are not equal (using `!=`).
*
* @example `isnt(response.body, "")`
*/
- def isnt[T] (got: T, expected: T): Boolean =
+ def isnt[T, U] (got: T, expected: U)(implicit e: U <:< T): Boolean =
test(got != expected, isntMessage(got))
/** Assert that two objects are not equal (using `!=`), and describe the
@@ -239,7 +241,9 @@ class TestMore (plan: Plan = NoPlan) extends Test with DelayedInit {
*
* @example `isnt(response.body, "", "we got a response body")`
*/
- def isnt[T] (got: T, expected: T, desc: String): Boolean =
+ def isnt[T, U] (got: T, expected: U, desc: String)(
+ implicit e: U <:< T
+ ): Boolean =
testWithDesc(got != expected, desc, isntMessage(got))
/** Assert that a string matches a regular expression.
Please sign in to comment.
Something went wrong with that request. Please try again.