-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace ansi-wl-print
with prettyprinter
#92
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,12 +3,18 @@ module Data.TreeDiff.QuickCheck ( | |
ediffEq, | ||
) where | ||
|
||
import Data.TreeDiff | ||
import System.Console.ANSI (SGR (Reset), setSGRCode) | ||
import Test.QuickCheck (Property, counterexample) | ||
import qualified Data.Text.Lazy as TL | ||
import Data.TreeDiff | ||
import Prettyprinter | ||
(defaultLayoutOptions, layoutPretty) | ||
import Prettyprinter.Render.Terminal (renderLazy) | ||
import System.Console.ANSI (SGR (Reset), setSGRCode) | ||
import Test.QuickCheck (Property, counterexample) | ||
|
||
-- | A variant of '===', which outputs a diff when values are inequal. | ||
ediffEq :: (Eq a, ToExpr a) => a -> a -> Property | ||
ediffEq x y = counterexample | ||
(setSGRCode [Reset] ++ show (ansiWlEditExpr $ ediff x y)) | ||
(setSGRCode [Reset] ++ render (ansiWlEditExpr $ ediff x y)) | ||
(x == y) | ||
where | ||
render = TL.unpack . renderLazy . layoutPretty defaultLayoutOptions | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. AFAICT, this is the only relevant change, properties are not coloured with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, #91 includes only this change, which is why I linked to it in #77 (comment). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why this change. AFAICT (by using this package very day),
ediffGolden
colors output?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct, there's no change in behavior here. There's a small change in the implementation because the
prettyprint
libraries have a different interface than theansi-wl-pprint
compatibility layer.