Code documentation for WithMessage is lacking (explanation of wildcards)
See original GitHub issueHey.
I got another small problem. I think the code documentation (xml comments, and online documentation) for the .WithMessage()
method on exceptions is a bit lacking.
I did not really understand what those special wildcards mean, and the method does not explain it really well.
I mean the *
is quite obvious, meaning a match-all from there-on, but what’s the ?
?
I had to dig into the source code to find that one out: https://github.com/fluentassertions/fluentassertions/blob/aa96583536589d3c860e695cdb075089b1cb0f56/Src/FluentAssertions/Primitives/StringWildcardMatchingValidator.cs#L42
What I would like to have
A quick note on the code documentation and online documentation explaining both wildcards with a sentence.
A side note: Are you sure that using the .*
pattern is what you want for the star wildcard? Isn’t .*?
the better choice, being non-greedy? That is especially important if someone decides to use the wildcard inside of a string.
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (5 by maintainers)
Top GitHub Comments
Yes, it works. And it’s what people want most of the time anyway. It’s sometime a bit confusing to understand regex really well, but this one should be easy. A good article on that: Why Using the Greedy .* in Regular Expressions Is Almost Never What You Actually Want
I am already working on a PR for the usages of Jetbrains annotations, so yeah, I will be able to do a PR for this (: Give me some time, I need to prepare a bit for it. (Setting up a new development system for myself currently) I also thought that I’ll write some additional logic so that you can match a star or question mark without them being replaced with the wildcard patterns, maybe with escaping them before.
Guess I should make unit tests for the code changes as well?
Is this one closed by #1586?