@@ -29,8 +29,10 @@ import Data.Map (Map)
2929import Data.Map qualified as Map
3030import Ledger (ExBudget (ExBudget ), ExCPU (ExCPU ), ExMemory (ExMemory ), TxId , Value )
3131import PlutusCore.Evaluation.Machine.ExMemory (CostingInteger )
32+ import Prettyprinter (Doc , align , defaultLayoutOptions , indent , layoutPretty , viaShow , vsep , (<+>) )
33+ import Prettyprinter.Render.String (renderString )
3234import Test.Plutip.Internal.Types (
33- ExecutionResult (contractState , outcome ),
35+ ExecutionResult (ExecutionResult , contractState , outcome ),
3436 FailureReason (CaughtException , ContractExecutionError ),
3537 budgets ,
3638 isSuccessful ,
@@ -83,9 +85,23 @@ shouldSucceed =
8385 Predicate
8486 " Contract should succeed"
8587 " Contract should fail"
86- (mappend " But it didn't.\n Result: " . show )
88+ (mappend " But it didn't.\n Result: " . renderString . layoutPretty defaultLayoutOptions . prettyExecutionResult )
8789 isSuccessful
8890
91+ -- | Pretty print ExecutionResult hiding budget stats and logs.
92+ prettyExecutionResult :: (Show e , Show w , Show a ) => ExecutionResult e w a -> Doc ann
93+ prettyExecutionResult ExecutionResult {outcome, contractState} =
94+ vsep
95+ [ " Execution result {"
96+ , indent 4 $
97+ align $
98+ vsep
99+ [ " outcome:" <+> viaShow outcome
100+ , " final state: " <+> viaShow contractState
101+ ]
102+ , " }"
103+ ]
104+
89105-- | Check that Contract didn't succeed.
90106--
91107-- @since 0.2
0 commit comments