-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Port NIM regex tests to improve test coverage #120846
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
Copilot finished work on behalf of
stephentoub
October 17, 2025 14:19
stephentoub
reviewed
Oct 17, 2025
src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/RegexNimTests.cs
Show resolved
Hide resolved
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.
Pull Request Overview
Ports Nim regex functional tests to expand .NET regex engine coverage and align with existing PCRE and Rust imported suites.
- Adds 181 Nim-derived test cases in a new RegexNimTests.cs file.
- Updates the test project file to include the new test source.
- Tests exercise multiple engines; lookaround tests are conditionally included.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
System.Text.RegularExpressions.Tests.csproj | Adds RegexNimTests.cs to build for inclusion of new test cases. |
RegexNimTests.cs | Introduces Nim-sourced regex functional tests across patterns, quantifiers, character classes, anchors, options, and lookarounds. |
src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/RegexNimTests.cs
Show resolved
Hide resolved
Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
Copilot finished work on behalf of
stephentoub
October 17, 2025 14:51
stephentoub
approved these changes
Oct 17, 2025
MihaZupan
approved these changes
Oct 17, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #61895
This PR ports regex functional tests from the nim-regex project to increase .NET's regex test coverage, following the same pattern used for PCRE and Rust test suites.
Changes
RegexNimTests.cs
with 156 unique test cases focusing on patterns not already covered by existing testsSystem.Text.RegularExpressions.Tests.csproj
to include the new test fileTest Coverage
The ported tests provide additional coverage for unique patterns including:
\*+
,\??
,\++?
- testing literal*
,+
,?
characters with quantifiers(a*)*
,(a*)*b
,((a)*(a)*)*
- edge case patternsa(b|c)*d
,((a(b)*)*(b)*)
, alternations with grouping\d
matching۲
,\D
matching⅕
(?<name>...)
syntax\b\b\b
patternsDeduplication
After analysis, 25 duplicate and trivial test cases were removed that were already covered by existing tests in
Regex.Match.Tests.cs
,Regex.Groups.Tests.cs
, and other test files. The remaining tests focus on unique patterns and edge cases.Compatibility Notes
Some NIM-specific patterns were excluded or adapted for .NET compatibility:
\y
escape sequence (not recognized in .NET)(?U)
ungreedy flag (not supported in .NET)(?P<name>)
to .NET's(?<name>)
formatTest Results
The MIT license for nim-regex was already present in
THIRD-PARTY-NOTICES.TXT
.Original prompt
Fixes #61895
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.