fix test for expect_failure

This commit is contained in:
Pierre Chambart 2018-06-23 16:18:33 +02:00
parent c2483da50f
commit 8ac056218c

View File

@ -200,7 +200,13 @@ let origination_contract_from_origination_contract_not_enough_fund fee () =
register_origination_inc ~credit:amount () >>=? fun (inc, contract) -> register_origination_inc ~credit:amount () >>=? fun (inc, contract) ->
(* contract's balance is not enough to afford origination burn *) (* contract's balance is not enough to afford origination burn *)
Op.origination ~fee (I inc) ~credit:amount contract >>=? fun (operation, orig_contract) -> Op.origination ~fee (I inc) ~credit:amount contract >>=? fun (operation, orig_contract) ->
Incremental.add_operation inc operation >>=? fun inc -> let expect_failure = function
| Alpha_environment.Ecoproto_error (Contract_storage.Balance_too_low _) :: _ ->
return ()
| _ ->
failwith "The contract has not enought funds, it fail !"
in
Incremental.add_operation ~expect_failure inc operation >>=? fun inc ->
Context.Contract.balance (I inc) contract >>=? fun balance_aft -> Context.Contract.balance (I inc) contract >>=? fun balance_aft ->
(* contract was debited of [fee] but not of origination burn *) (* contract was debited of [fee] but not of origination burn *)
Assert.balance_was_debited ~loc:__LOC__ (I inc) contract balance_aft fee >>=? fun () -> Assert.balance_was_debited ~loc:__LOC__ (I inc) contract balance_aft fee >>=? fun () ->