-
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
base: main
Are you sure you want to change the base?
Conversation
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>
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>
Tagging subscribers to this area: @dotnet/area-system-text-regularexpressions |
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.