/tests/src/test/scala/scalaz/FunctorTest.scala
Scala | 32 lines | 25 code | 7 blank | 0 comment | 0 complexity | 9d3844f08b94ea05945d1071e82165d7 MD5 | raw file
1package scalaz 2 3import std.AllInstances._ 4import std.option.some 5import syntax.functor._ 6import org.scalacheck.Prop.forAll 7 8object FunctorTest extends SpecLite { 9 10 "mapply" in { 11 1.mapply(some((a: Int) => a)) must_===(some(1)) 12 } 13 14 "map" in { 15 (some(1) ∘ (1+)) must_===(some(2)) 16 } 17 18 "strength" in { 19 some(1).strengthL(2) must_===(some((2, 1))) 20 some(1).strengthR(2) must_===(some((1, 2))) 21 } 22 23 "fpair" in { 24 some(1).fpair must_===(some((1, 1))) 25 } 26 27 "widen" ! forAll { ola: Option[List[Int]] => 28 import std.iterable._ 29 val oia: Option[Iterable[Int]] = ola 30 ola.widen[Iterable[Int]] must_===(oia) 31 } 32}