aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2013-04-04 15:24:43 -0500
committerJesse Luehrs <doy@tozt.net>2013-04-04 15:24:43 -0500
commit7d8bf9f5b6952c39650be00a1e8bd7f1d950c681 (patch)
tree6efb43c166fc8a2269c8b5e20767a2253dd26d4c
parent7c24b8e0506e8f960605c7b198762149a9777d99 (diff)
downloadscala-test-more-7d8bf9f5b6952c39650be00a1e8bd7f1d950c681.tar.gz
scala-test-more-7d8bf9f5b6952c39650be00a1e8bd7f1d950c681.zip
fix these type constraints (rafl)
-rw-r--r--src/main/scala/com/iinteractive/test/TestMore.scala12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/main/scala/com/iinteractive/test/TestMore.scala b/src/main/scala/com/iinteractive/test/TestMore.scala
index 9eedf68..22b190a 100644
--- a/src/main/scala/com/iinteractive/test/TestMore.scala
+++ b/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.