module Data.Portray.Diff.QuickCheck ((=-=)) where
import Test.QuickCheck (Property, counterexample)
import Data.Portray.Diff (Diff(..))
import Data.Portray.Pretty (prettyShowPortrayal)
infix 4 =-=
(=-=) :: Diff a => a -> a -> Property
=-= :: a -> a -> Property
(=-=) a
a a
b = (String -> Bool -> Property) -> (String, Bool) -> Property
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry String -> Bool -> Property
forall prop. Testable prop => String -> prop -> Property
counterexample ((String, Bool) -> Property) -> (String, Bool) -> Property
forall a b. (a -> b) -> a -> b
$ case a -> a -> Maybe Portrayal
forall a. Diff a => a -> a -> Maybe Portrayal
diff a
a a
b of
Maybe Portrayal
Nothing -> (String
"", Bool
True)
Just Portrayal
d -> (Portrayal -> String
prettyShowPortrayal Portrayal
d, Bool
False)