From 65613fd889069b2fa75b00700f401be1b22c7aff Mon Sep 17 00:00:00 2001 From: Ignat Insarov Date: Thu, 20 Jul 2023 17:08:53 +0300 Subject: [PATCH] Add tests for the bridging of `Show` instances. --- test/Spec.hs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/test/Spec.hs b/test/Spec.hs index 8316ef40..c04b5dba 100644 --- a/test/Spec.hs +++ b/test/Spec.hs @@ -39,7 +39,7 @@ allTests = do in bst `shouldBe` ti it "tests with custom type Foo" $ let prox = Proxy :: Proxy Foo - bst = bridgeSumType (buildBridge defaultBridge) (order prox $ mkSumType prox) + bst = bridgeSumType (buildBridge defaultBridge) (showing prox . order prox $ mkSumType prox) st = SumType TypeInfo {_typePackage = "", _typeModule = "TestData", _typeName = "Foo", _typeParameters = []} @@ -57,11 +57,11 @@ allTests = do ] } ] - [Eq, Ord, Encode, Decode, EncodeJson, DecodeJson, Generic] + [Show, Eq, Ord, Encode, Decode, EncodeJson, DecodeJson, Generic] in bst `shouldBe` st it "tests generation of for custom type Foo" $ let prox = Proxy :: Proxy Foo - recType = bridgeSumType (buildBridge defaultBridge) (order prox $ mkSumType prox) + recType = bridgeSumType (buildBridge defaultBridge) (showing prox . order prox $ mkSumType prox) recTypeText = sumTypeToText defaultSettings recType txt = T.stripEnd $ @@ -71,6 +71,9 @@ allTests = do , " | Bar Int" , " | FooBar Int String" , "" + , "instance showFoo ∷ Show Foo where" + , " show value = genericShow value" + , "" , "derive instance eqFoo :: Eq Foo" , "derive instance ordFoo :: Ord Foo" , "instance encodeJsonFoo :: EncodeJson Foo where"