-
-
Notifications
You must be signed in to change notification settings - Fork 95
feat: add more regex assertions #3558
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
Conversation
|
Claude finished @thomhurst's task —— View job Code Review Complete ✅Todo List:
Overall AssessmentThis PR successfully adds robust regex assertion capabilities to TUnit with proper match result access. The implementation follows TUnit's coding standards and performance requirements well. ✅ StrengthsCode Quality & Design
Performance Considerations
Test Coverage
Security & Robustness
🔍 Areas for ImprovementMinor Issues1. Exception Ordering (StringAssertions.cs:484-491)The current implementation validates regex before checking null input: var regex = _regex ?? new Regex(_pattern, _options); // May throw RegexParseException
if (value == null) // Check comes after regex validation
{
throw new ArgumentNullException(nameof(value), "value was null");
}Impact: Low - This is likely intentional based on the comment, but could be confusing. 2. Documentation GapThe documentation in // This doesn't match the actual API:
await Assert.That(email)
.Matches(pattern)
.Group("username", user => user.IsEqualTo("john.doe")) // This doesn't existThe actual API is: var match = await Assert.That(email).Matches(pattern).GetMatchAsync();
await Assert.That(match.Group("username")).IsEqualTo("john.doe");3. Missing using statement (RegexMatchResult.cs:14)The 📋 Repository Compliance✅ Follows TUnit Guidelines
✅ Testing Standards
🚀 RecommendationsHigh Priority
Low Priority
🎯 VerdictRecommend approval with documentation updates. This is a well-implemented feature that:
The only significant issue is the documentation mismatch, which should be addressed before merge. |
5affcfc to
a3c3376
Compare
|
Claude finished @thomhurst's task —— View job Code Review Complete ✅Todo List:
Overall AssessmentThis PR successfully adds robust regex assertion capabilities to TUnit with proper match result access. The implementation follows TUnit's coding standards and performance requirements well. ✅ StrengthsCode Quality & Design
Performance Considerations
Test Coverage
Security & Robustness
🔍 Areas for ImprovementCritical IssueDocumentation API MismatchThe documentation in Documentation shows: await Assert.That(email)
.Matches(pattern)
.Group("username", user => user.IsEqualTo("john.doe")) // This doesn't exist
.And.Group("domain", domain => domain.IsEqualTo("example.com"));Actual API is: var match = await Assert.That(email).Matches(pattern).GetMatchAsync();
await Assert.That(match.Group("username")).IsEqualTo("john.doe");
await Assert.That(match.Group("domain")).IsEqualTo("example.com");The entire documentation (lines 30-291) describes fluent group assertion methods that aren't implemented. Minor Issues1. Missing using statement (RegexMatchResult.cs:14)The 2. Exception Ordering (StringAssertions.cs:484-491)The implementation validates regex before checking null input: var regex = _regex ?? new Regex(_pattern, _options); // May throw RegexParseException
if (value == null) // Check comes after regex validation
{
throw new ArgumentNullException(nameof(value), "value was null");
}Impact: Low - This appears intentional based on the comment, but could be confusing. 📋 Repository Compliance✅ Follows TUnit Guidelines
✅ Testing Standards
🚀 RecommendationsHigh Priority
Low Priority
🎯 VerdictRecommend approval with documentation updates. This is a well-implemented feature that:
The critical issue is the documentation mismatch which creates confusion between expected vs actual API usage. This should be addressed before merge. |
|
Claude finished @thomhurst's task —— View job Code Review Complete ✅Todo List:
Overall AssessmentThis PR successfully adds robust regex assertion capabilities to TUnit with proper match result access. The implementation follows TUnit's coding standards and performance requirements well. ✅ StrengthsCode Quality & Design
Performance Considerations
Test Coverage
Security & Robustness
🔍 Areas for ImprovementMinor Issues1. Exception Ordering (StringAssertions.cs:484-491)The current implementation validates regex before checking null input: var regex = _regex ?? new Regex(_pattern, _options); // May throw RegexParseException
if (value == null) // Check comes after regex validation
{
throw new ArgumentNullException(nameof(value), "value was null");
}Impact: Low - This is likely intentional based on the comment, but could be confusing. 2. Documentation GapThe documentation in // This doesn't match the actual API:
await Assert.That(email)
.Matches(pattern)
.Group("username", user => user.IsEqualTo("john.doe")) // This doesn't existThe actual API is: var match = await Assert.That(email).Matches(pattern).GetMatchAsync();
await Assert.That(match.Group("username")).IsEqualTo("john.doe");3. Missing using statement (RegexMatchResult.cs:14)The 📋 Repository Compliance✅ Follows TUnit Guidelines
✅ Testing Standards
🚀 RecommendationsHigh Priority
Low Priority
🎯 VerdictRecommend approval with documentation updates. This is a well-implemented feature that:
The only significant issue is the documentation mismatch, which should be addressed before merge. |
|
Claude finished @thomhurst's task —— View job Code Review Complete ✅Todo List:
Overall AssessmentThis PR adds a comprehensive and well-designed regex assertion API to TUnit. The implementation follows TUnit's architectural patterns and provides a fluent, intuitive interface for regex-based assertions with group access. ✅ StrengthsArchitecture & Design
Code Quality
Performance Considerations ⭐
Test Coverage
🔍 Areas for ImprovementCritical Issues1. Documentation API Mismatch 🚨The documentation shows methods that don't exist in the implementation: Documentation shows (docs/docs/assertions/regex-assertions.md:106): await Assert.That(text)
.Matches(pattern)
.AtIndex(12); // ❌ AtIndex method doesn't existDocumentation shows (docs/docs/assertions/regex-assertions.md:110): await Assert.That(text)
.Matches(pattern)
.HasLength(3); // ❌ HasLength method doesn't existThe documentation describes fluent Actual API: var match = await Assert.That(text).Matches(pattern).And.Match(0);
// Then access match.Index, match.Length, match.ValueMinor Issues2. Potential Confusion with Method OverloadsRegexAssertionExtensions.cs has multiple
While functionally correct, the API surface is quite large. 3. Missing Exception DocumentationThe 📋 Repository Compliance✅ Follows TUnit Guidelines
✅ Testing Standards
🔒 Security & Robustness
🚀 RecommendationsHigh Priority
Medium Priority
Low Priority
🎯 VerdictStrongly recommend approval with documentation fixes. This is an excellent implementation that:
The main blocker is the documentation mismatch which could confuse users. Once the documentation accurately reflects the implemented API, this feature will be a valuable addition to TUnit. Code Quality: A- | Architecture: A | Performance: A | Testing: B+ | Documentation: C (due to mismatch) |
No description provided.