-
-
Notifications
You must be signed in to change notification settings - Fork 105
add taskAssert computation expression for simplified assertions in F# #3977
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
Code Review: F# taskAssert Computation ExpressionThank you for this contribution! This is a clean and idiomatic F# enhancement that significantly improves the assertion experience for F# users. Here's my detailed review: ✅ Strengths1. Excellent F# Idioms
2. Clean Implementation
3. Good Documentation
4. Comprehensive Test Coverage
🔍 Observations & Minor Suggestions1. Test Duplication
I recommend Option A for this PR since:
2. Performance Considerations
✅ No performance concerns identified 3. Type Signature Clarity member inline x.Bind(assertion: IAssertion, continuation: Unit -> TaskCode<'TOverall, 'TResult2>)The 🛡️ Security & Safety✅ No security concerns
📋 Checklist (Based on CLAUDE.md)Let me verify against the project's requirements:
🎯 Final AssessmentRecommendation: ✅ APPROVE with minor suggestion This PR is well-implemented and ready to merge. The code is:
Optional Enhancement (Non-blocking)Consider adding one additional test case demonstrating assertion failure behavior to ensure the CE properly propagates exceptions: [<Test>]
[<Category("Fail")>]
member _.FailingAssertion_ThrowsCorrectly() : Task =
taskAssert {
do! Assert.That(1 + 1).IsEqualTo(3) // Should fail
}This would verify the error handling path works correctly, though it's likely already covered by existing assertion tests. Great work, @marcpiechura! This is a valuable addition to TUnit's F# support. 🎉 |
|
Thanks @marcpiechura ! Do you mind adding the negative assertion test as suggested by Claude? So we can confirm it correctly throws if an assertion fails. |
|
Sure thing, I've added the test. |
As discussed, I've used the new taskAssert expression in all of my tests and it's working as expected, so I think it's good to go.
closes #3971