You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
String not-regex constraint succeeds non-string actual value #4484
changed the title [-]String not-regex constraint succeeds on `null` actual value[/-][+]String not-regex constraint succeeds non-`string` actual value[/+]on Oct 10, 2023
Activity
OsirisTerje commentedon Oct 9, 2023
Well,.... null does not match any regex, so the statement there is true.
You could try:
RenderMichael commentedon Oct 10, 2023
That's a philosophical statement, and I see the point.
On the other hand, .NET's built-in regex throws when calling
Matches(null).Additionally, the constraint calls
actual is string actualStr && Regex.Matches(actualStr)(pseudocode since I don't have the code in front of me).So the following also passes, although it's flagged by NUnit.Analyzers
edit: in fact, that's good broadening of the issue, I'll rename it
[-]String not-regex constraint succeeds on `null` actual value[/-][+]String not-regex constraint succeeds non-`string` actual value[/+]OsirisTerje commentedon Oct 10, 2023
If .Net does so, we should probably do the same.
RenderMichael commentedon Oct 10, 2023
Would love to be assigned this PBI, I can spin up a PR for it
OsirisTerje commentedon Oct 10, 2023
There you are :-) Have fun!