Skip to content

Commit

Permalink
Added forgotten Diff.hs
Browse files Browse the repository at this point in the history
  • Loading branch information
qrilka committed Jul 11, 2016
1 parent 00e0cfa commit a22ab65
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/Diff.hs
@@ -0,0 +1,14 @@
module Diff where

import Data.Algorithm.Diff (Diff (..), getGroupedDiff)
import Data.Algorithm.DiffOutput (ppDiff)
import Data.Monoid ((<>))
import Test.Tasty.HUnit (Assertion, assertBool)
import Text.Groom (groom)

-- | Like '@=?' but producing a diff on failure.
(@==?) :: (Eq a, Show a) => a -> a -> Assertion
x @==? y =
assertBool ("Expected:\n" <> groom x <> "\nDifference:\n" <> msg) (x == y)
where
msg = ppDiff $ getGroupedDiff (lines . groom $ x) (lines . groom $ y)

0 comments on commit a22ab65

Please sign in to comment.