Permalink
Browse files

fix these type constraints (rafl)

  • Loading branch information...
1 parent 7c24b8e commit 7d8bf9f5b6952c39650be00a1e8bd7f1d950c681 @doy committed Apr 4, 2013
Showing with 8 additions and 4 deletions.
  1. +8 −4 src/main/scala/com/iinteractive/test/TestMore.scala
@@ -216,30 +216,34 @@ 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
* assertion.
*
* @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
* assertion.
*
* @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.

0 comments on commit 7d8bf9f

Please sign in to comment.