Advertisement
Guest User

Untitled

a guest
Sep 18th, 2019
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. daml 1.2
  2. module Demo where
  3.  
  4. template Loan
  5. with
  6. owner : Party
  7. where
  8. signatory owner
  9.  
  10. controller owner can
  11. Loan_Apply : ContractId Loan
  12. with
  13. age : Int
  14. amount : Decimal
  15. do
  16. assertMsg "must be over 18 years of age" $ age > 18
  17. assertMsg "loan value must be at least 120.00" $ amount >= 120.0
  18.  
  19. create this
  20.  
  21.  
  22. test_demo = scenario do
  23. alice <- getParty "alice"
  24.  
  25. cid <- submit alice do
  26. create Loan with owner = alice
  27.  
  28.  
  29. {--
  30. This example assertion results in the following output
  31.  
  32. Scenario execution failed:
  33. A must-fail commit aborted due to an unexpected failure message
  34. expected: "must be over 18"
  35. actual: "loan value must be at least 120.00"
  36. -}
  37. submitMustFailMsg alice "must be over 18" do
  38. exercise cid Loan_Apply with
  39. age = 19
  40. amount = 119.00
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement