Skip to content

Commit

Permalink
Adds test for Show[Const]
Browse files Browse the repository at this point in the history
Adds a test for Show[Const], includes
* Simple test of a specific value
* Test that all output starts with Const(
* Test that the Show for the contained value is contained in the result
* Test that implicitly obtained Show instance produces a consistent
result
* Tests that retagging the Const does not affect the show result
  • Loading branch information
mikejcurry committed Nov 28, 2015
1 parent 5d879c1 commit 2dac4f5
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/src/test/scala/cats/tests/ConstTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,19 @@ class ConstTests extends CatsSuite {

checkAll("Const[String, Int]", ContravariantTests[Const[String, ?]].contravariant[Int, Int, Int])
checkAll("Contravariant[Const[String, ?]]", SerializableTests.serializable(Contravariant[Const[String, ?]]))

test("show") {

Const(1).show should === ("Const(1)")

forAll { const: Const[Int, String] =>
const.show.startsWith("Const(") should === (true)
const.show.contains(const.getConst.show)
const.show should === (implicitly[Show[Const[Int, String]]].show(const))
const.show should === (const.retag[Boolean].show)
}
}



}

0 comments on commit 2dac4f5

Please sign in to comment.