Skip to content

Add type validation to regex constraint - #4492

Merged
manfred-brands merged 2 commits into
nunit:masterfrom
RenderMichael:regex
Oct 11, 2023
Merged

manfred-brands merged 2 commits into
nunit:masterfrom
RenderMichael:regex

Conversation

@RenderMichael

@RenderMichael RenderMichael commented Oct 10, 2023 •

Copy link
Copy Markdown
Contributor

Fixes #4484
tests like

Assert.That(1, Does.Not.Match("[A-Z]"));
Assert.That((string?)null, Does.Not.Match("[A-Z]"));

will no longer pass.

Bonus performance for converting regex.Match(...).Success to regex.IsMatch(...)

Bonus performance for converting `regex.Match(...).Success` to `regex.IsMatch(...)`

@manfred-brands manfred-brands left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @RenderMichael Your code changes are functionally fine.
My nitpicks are purely to get a more consistent code base.

@RenderMichael

Copy link
Copy Markdown
Contributor Author

@manfred-brands thanks for the review! feedback merged, PTAL

@manfred-brands manfred-brands left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for that. Nothing further.

@manfred-brands
manfred-brands merged commit 8e73942 into nunit:master Oct 11, 2023
@RenderMichael
RenderMichael deleted the regex branch March 9, 2024 07:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

String not-regex constraint succeeds non-string actual value

2 participants