From 2dac4f5649b7439aa6778db3f1e70a9f09ee2b16 Mon Sep 17 00:00:00 2001 From: Mike Curry Date: Sat, 28 Nov 2015 19:04:39 +0000 Subject: [PATCH] Adds test for Show[Const] 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 --- tests/src/test/scala/cats/tests/ConstTests.scala | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/src/test/scala/cats/tests/ConstTests.scala b/tests/src/test/scala/cats/tests/ConstTests.scala index 68334f0a6c..d3bc49c6ab 100644 --- a/tests/src/test/scala/cats/tests/ConstTests.scala +++ b/tests/src/test/scala/cats/tests/ConstTests.scala @@ -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) + } + } + + + }