Skip to content

Commit

Permalink
Merge pull request #686 from mikejcurry/oneand-show-test
Browse files Browse the repository at this point in the history
Add test for Show[OneAnd]
  • Loading branch information
fthomas committed Nov 21, 2015
2 parents b07df91 + 0a2ac48 commit 482bc2e
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/src/test/scala/cats/tests/OneAndTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,20 @@ class OneAndTests extends CatsSuite {
checkAll("NonEmptyList[Int]", ComonadTests[NonEmptyList].comonad[Int, Int, Int])
checkAll("Comonad[NonEmptyList[A]]", SerializableTests.serializable(Comonad[NonEmptyList]))

test("Show is not empty and is formatted as expected") {
forAll { (nel: NonEmptyList[Int]) =>
nel.show.nonEmpty should === (true)
nel.show.startsWith("OneAnd(") should === (true)
nel.show should === (implicitly[Show[NonEmptyList[Int]]].show(nel))
nel.show.contains(nel.head.show) should === (true)
}
}

test("Show is formatted correctly") {
val oneAnd = NonEmptyList("Test", Nil)
oneAnd.show should === ("OneAnd(Test, List())")
}

test("Creating OneAnd + unwrap is identity") {
forAll { (i: Int, tail: List[Int]) =>
val list = i :: tail
Expand Down

0 comments on commit 482bc2e

Please sign in to comment.