-
Notifications
You must be signed in to change notification settings - Fork 24
Open
Description
Hi, thanks for writing this library! It's great for printing out much simplified test assertion data when asserting equality on objects with a JSON form (in leiu of a dedicated delta / diff framework).
I have noticed that when an element is moved in a list, I'm seeing an ADD/REMOVE instead of a MOVE. I assume this comes from the edit-distance library under the hood which presumably doesn't detect MOVE operations. If there is a cleanup stage it might be worth adding a rewrite rule to simplify forms of this shape.
Minimal repro
#! /usr/bin/env cabal
{- cabal:
build-depends: base, aeson, aeson-diff
-}
module Main where
import Data.Aeson
import Data.Aeson.Diff
main :: IO ()
main = do
let lst1 = toJSON ["a", "b", "c"]
lst2 = toJSON ["a", "c", "b"]
putStrLn . show $ diff lst1 lst2
got
Patch {patchOperations = [
Add {changePointer = Pointer {pointerPath = [AKey 1]}, changeValue = String "c"},
Rem {changePointer = Pointer {pointerPath = [AKey 3]}}]}
expected a Mov
.
Metadata
Metadata
Assignees
Labels
No labels