-
-
Notifications
You must be signed in to change notification settings - Fork 203
✨ Add maxLength support to stringMatching #6285
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
base: main
Are you sure you want to change the base?
✨ Add maxLength support to stringMatching #6285
Conversation
🦋 Changeset detectedLatest commit: 77572c0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@fast-check/ava
@fast-check/expect-type
fast-check
@fast-check/jest
@fast-check/packaged
@fast-check/poisoning
@fast-check/vitest
@fast-check/worker
commit: |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6285 +/- ##
==========================================
- Coverage 95.04% 95.02% -0.03%
==========================================
Files 200 200
Lines 5309 5326 +17
Branches 1401 1409 +8
==========================================
+ Hits 5046 5061 +15
- Misses 251 253 +2
Partials 12 12
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
0eec009 to
ece7949
Compare
b02cc7c to
77572c0
Compare
|
Note the patch has 100% coverage. Not sure why codecov is complaining. |
| } | ||
| case 'Range': { | ||
| // Cap quantifiers to user's maxLength constraint to prevent unbounded generation | ||
| const userMaxLength = constraints.maxLength; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather deal with everything linked to maxLength at the same place. So I'd either move these checks when we parse the regex (as you did for wildcard) or move them when reading from the parsed regex. I'd honestly rather advocate for the second option so that parsing stays totally agnostic of this notion of length.
Description
This is a weaker implementation as mentioned in #5562 but one which I think is superior to just adding a filter by hand.
Propagating max downstream means we do contain a bit better performance wise though we still need to filter the final result.
Also explored min but that seemed less valuable than containing max better.
Checklist — Don't delete this checklist and make sure you do the following before opening the PR
pnpm run bumpand flag the impacts properlyAdvanced