Skip to content

Commit b3127f9

Browse files
Used printf for some error messages.
1 parent 92bf043 commit b3127f9

File tree

1 file changed

+13
-20
lines changed

1 file changed

+13
-20
lines changed

test/Spec/BotPlutusInterface/Balance.hs

+13-20
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ import Spec.MockContract (
5151
)
5252
import Test.Tasty (TestTree, testGroup)
5353
import Test.Tasty.HUnit (Assertion, assertBool, assertFailure, testCase, (@?=))
54+
import Text.Printf (printf)
5455
import Prelude
5556

5657
{- | Tests for 'cardano-cli query utxo' result parsers
@@ -239,13 +240,13 @@ dontAddChangeToDatum = do
239240
(balScrUtxos, balOtherUtxos) = partition isScrUtxo (txOutputs trx)
240241
assertBool
241242
( "Expected UTxO not in output Tx."
242-
<> "\nExpected UTxO: "
243+
<> "\nExpected UTxO: \n"
243244
<> show scrTxOutExpected
244-
<> "\nBalanced Script UTxOs: "
245+
<> "\nBalanced Script UTxOs: \n"
245246
<> show balScrUtxos
246-
<> "\nOther Balanced UTxOs: "
247+
<> "\nOther Balanced UTxOs: \n"
247248
<> show balOtherUtxos
248-
<> "\nUnbalanced UTxOs: "
249+
<> "\nUnbalanced UTxOs: \n"
249250
<> show (txOutputs (unbalancedTx ^. OffChain.tx))
250251
)
251252
(scrTxOutExpected `elem` txOutputs trx)
@@ -306,13 +307,13 @@ dontAddChangeToDatum2 = do
306307
-- is in the output.
307308
assertBool
308309
( "Expected UTxO not in output Tx."
309-
<> "\nExpected UTxO: "
310+
<> "\nExpected UTxO: \n"
310311
<> show scrTxOutExpected
311-
<> "\nBalanced Script UTxOs: "
312+
<> "\nBalanced Script UTxOs: \n"
312313
<> show balScrUtxos
313-
<> "\nOther Balanced UTxOs: "
314+
<> "\nOther Balanced UTxOs: \n"
314315
<> show balOtherUtxos
315-
<> "\nUnbalanced UTxOs: "
316+
<> "\nUnbalanced UTxOs: \n"
316317
<> show (txOutputs (unbalancedTx ^. OffChain.tx))
317318
)
318319
(scrTxOutExpected `elem` txOutputs trx)
@@ -331,23 +332,15 @@ dontAddChangeToDatum2 = do
331332
-- Check for ADA change
332333
assertBool
333334
( "Other UTxOs do not contain expected ADA change."
334-
<> "\nExpected Amount : "
335-
<> show adaChange
336-
<> " Lovelace"
337-
<> "\nActual Amount : "
338-
<> show (lovelaceInValue remainingValue)
339-
<> " Lovelace"
335+
<> printf "\nExpected Amount : %d Lovelace" adaChange
336+
<> printf "\nActual Amount : %d Lovelace" (lovelaceInValue remainingValue)
340337
)
341338
(adaChange == lovelaceInValue remainingValue)
342339
-- Check for Token change
343340
assertBool
344341
( "Other UTxOs do not contain expected Token change."
345-
<> "\nExpected Amount : "
346-
<> show tokChange
347-
<> " tokens"
348-
<> "\nActual Amount : "
349-
<> show (acValueOf tokenAsset remainingValue)
350-
<> " tokens"
342+
<> printf "\nExpected Amount : %d tokens" tokChange
343+
<> printf "\nActual Amount : %d tokens" (acValueOf tokenAsset remainingValue)
351344
)
352345
(tokChange == acValueOf tokenAsset remainingValue)
353346

0 commit comments

Comments
 (0)