Test the Show instance for TryFromException

This commit is contained in:
Taylor Fausak 2021-09-04 14:30:01 +00:00 committed by GitHub
parent 8c3ad74485
commit d312023851

View File

@ -1,6 +1,7 @@
{-# OPTIONS_GHC -Wno-error=overflowed-literals #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE NegativeLiterals #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeApplications #-}
@ -91,6 +92,12 @@ main = runTestTTAndExit $ "Witch" ~:
[ $$(Witch.liftedInto @Int.Int8 (1 :: Int.Int16)) ~?= 1
]
]
, "TryFromException" ~:
[ "show" ~:
[ show (Witch.TryFromException @Int @Int 0 Nothing) ~?= "TryFromException @Int @Int 0 Nothing"
, show (Witch.TryFromException @(Seq.Seq Int) @(Seq.Seq Int) (Seq.fromList []) (Just (Exception.toException Exception.Overflow))) ~?= "TryFromException @(Seq Int) @(Seq Int) (fromList []) (Just arithmetic overflow)"
]
]
, "Instances" ~:
[ "From a a" ~:
let f = Witch.from @Int @Int in