File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed
test/Spec/BotPlutusInterface Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -215,6 +215,7 @@ test-suite bot-plutus-interface-test
215215 , plutus-pab
216216 , plutus-tx
217217 , plutus-tx-plugin
218+ , pretty-diff
218219 , prettyprinter
219220 , QuickCheck
220221 , quickcheck-instances
Original file line number Diff line number Diff line change @@ -45,6 +45,11 @@ import Plutus.Contract (
4545 )
4646import PlutusTx qualified
4747import PlutusTx.Builtins (fromBuiltin )
48+ import Pretty.Diff (
49+ MultilineContext (FullContext ),
50+ Wrapping (Wrap ),
51+ )
52+ import Pretty.Diff qualified as Diff
4853import Spec.MockContract (
4954 MockContractState (.. ),
5055 addr1 ,
@@ -898,7 +903,16 @@ assertCommandHistory state =
898903assertCommandEqual :: String -> Text -> Text -> Assertion
899904assertCommandEqual err expected actual
900905 | commandEqual expected actual = return ()
901- | otherwise = assertFailure $ err ++ " \n Expected:\n " ++ show expected ++ " \n Got:\n " ++ show actual
906+ | otherwise =
907+ assertFailure $
908+ err ++ " \n " ++ prettyPrintDiff expected actual
909+
910+ prettyPrintDiff :: Text -> Text -> String
911+ prettyPrintDiff expected actual =
912+ " \n Expected:\n "
913+ ++ Text. unpack (Diff. above (Wrap 80 ) FullContext (Text. replace " \n " " " expected) actual)
914+ ++ " \n Got:\n "
915+ ++ Text. unpack (Diff. below (Wrap 80 ) FullContext (Text. replace " \n " " " expected) actual)
902916
903917{- | Checks if a command matches an expected command pattern
904918 Where a command pattern may use new lines in place of spaces, and use the wildcard `?` to match up to the next space
You can’t perform that action at this time.
0 commit comments