noir-lang / noir

Noir is a domain specific language for zero knowledge proofs
https://noir-lang.org
Apache License 2.0
821 stars 177 forks source link

feat: let `should_fail_with` check that the failure reason contains the expected message #5319

Closed asterite closed 5 days ago

asterite commented 6 days ago

Description

Problem

Resolves #4786

Summary

#[test(should_fail_with = "message")] will now check that "message" is a substring of the failure reason. I think this is a backwards-compatible change.

I thought about supporting regular expressions, as suggested in the related issue, but I didn't know how to signal that it's a regex or just "contains". I guess that could be done with another name, something like should_with_with_regexp 🤔 (in a separate PR, if really needed/wanted)

Additional Context

None

Documentation

Check one:

PR Checklist*

github-actions[bot] commented 6 days ago

🚀 Deployed on https://6679cdfe39fd8c2641fa47ec--noir-docs.netlify.app

github-actions[bot] commented 6 days ago

FYI @noir-lang/developerrelations on Noir doc changes.