Skip to content

Commit c4bdf29

Browse files
jakzaljuanpedromoreno
authored andcommitted
Expand the type signatures exercise with instanceof checks for a class and a trait (#89)
1 parent e3989df commit c4bdf29

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/main/scala/stdlib/TypeSignatures.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ object TypeSignatures extends FlatSpec with Matchers with org.scalaexercises.def
6262

6363
/** `isInstanceOf[className]` is used to determine if an object reference is an instance of a given class:
6464
*/
65-
def isInstanceOfFunctionTypeSignatures(res0: Boolean) {
65+
def isInstanceOfFunctionTypeSignatures(res0: Boolean, res1: Boolean, res2: Boolean) {
6666
trait Randomizer[A] {
6767
def draw(): A
6868
}
@@ -75,7 +75,9 @@ object TypeSignatures extends FlatSpec with Matchers with org.scalaexercises.def
7575
}
7676

7777
val intRand = new IntRandomizer
78-
intRand.draw.isInstanceOf[Int] should be(res0)
78+
intRand.isInstanceOf[IntRandomizer] should be(res0)
79+
intRand.isInstanceOf[Randomizer[Int]] should be(res1)
80+
intRand.draw.isInstanceOf[Int] should be(res2)
7981
}
8082

8183
}

src/test/scala/stdlib/TypeSignaturesSpec.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class TypeSignaturesSpec extends Spec with Checkers {
4343
check(
4444
Test.testSuccess(
4545
TypeSignatures.isInstanceOfFunctionTypeSignatures _,
46-
true :: HNil
46+
true :: true :: true :: HNil
4747
)
4848
)
4949
}

0 commit comments

Comments
 (0)