Skip to content
Snippets Groups Projects

[#537] Add predicate to expect any custom error

Merged Nikolay Yakimov requested to merge lierdakil/#537-cleveland-expect-any-custom-error into master

Description

Problem: sometimes we want to test a contract that might throw both simple text and pairs of text and some argument as errors (as per FA2 standard). We also might not care which one exactly. There's currently no simple way to test for such cases.

Solution: Add failedWithPredicate, which allows testing the error value (represented as a raw Expression) against some predicate. Implement failedWith in terms of failedWithPredicate. Add expectAnyCustomError function, which treats the failwith error as an untyped value and checks if it could in theory be typechecked as either string or pair string *. Discards the argument if it exists.

Related issue(s)

Resolves #537 (closed)

:white_check_mark: Checklist for your Merge Request

Related changes (conditional)

  • Tests (see short guidelines)

    • If I added new functionality, I added tests covering it.
    • If I fixed a bug, I added a regression test to prevent the bug from silently reappearing again.
  • Documentation

    • I checked whether I should update the docs and did so if necessary:
    • I updated changelog files of all affected packages released to Hackage if my changes are externally visible.

Stylistic guide (mandatory)

Edited by Nikolay Yakimov

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
Please register or sign in to reply
Loading