Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve #test[(should_fail_with)] #4786

Closed
nventuro opened this issue Apr 11, 2024 · 0 comments · Fixed by #5319
Closed

Improve #test[(should_fail_with)] #4786

nventuro opened this issue Apr 11, 2024 · 0 comments · Fixed by #5319
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@nventuro
Copy link
Contributor

nventuro commented Apr 11, 2024

Problem

Currently should_fail_with expects a perfect match in the reason - it'd be great to extend this to allow for more flexible matching.

Happy Case

Support for e.g. regexes or wildcards might be overkill - at least checking that the expected reason is a substring of the actual reason would be I think a great improvement.

@nventuro nventuro added the enhancement New feature or request label Apr 11, 2024
@github-project-automation github-project-automation bot moved this to 📋 Backlog in Noir Apr 11, 2024
@TomAFrench TomAFrench added the good first issue Good for newcomers label Jun 24, 2024
@asterite asterite moved this from 📋 Backlog to 🏗 In progress in Noir Jun 24, 2024
github-merge-queue bot pushed a commit that referenced this issue Jun 25, 2024
…he expected message (#5319)

# 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:
- [ ] No documentation needed.
- [x] Documentation included in this PR.
- [ ] **[For Experimental Features]** Documentation to be submitted in a
separate PR.

# PR Checklist\*

- [x] I have tested the changes locally.
- [x] I have formatted the changes with [Prettier](https://prettier.io/)
and/or `cargo fmt` on default settings.
@github-project-automation github-project-automation bot moved this from 🏗 In progress to ✅ Done in Noir Jun 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
Status: Done
3 participants