Skip to content

Commit

Permalink
Add tests for the bridging of Show instances.
Browse files Browse the repository at this point in the history
  • Loading branch information
kindaro committed Jul 20, 2023
1 parent 17a1922 commit 65613fd
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions test/Spec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []}
Expand All @@ -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 $
Expand All @@ -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"
Expand Down

0 comments on commit 65613fd

Please sign in to comment.