google / google/truth

Deprecate StringSubject.doesNotMatch?

Open
#790 0 comments 0 reactions 0 assignees View on GitHub
P3 type=defect
Dominant language
Java
Stars
2.8k
Forks
275
Avg merge
7m
Merged PRs (30d)
4

Description

As noted in https://github.com/google/truth/pull/789#issuecomment-732213007, it's _very_ frequently misused.

Users who want that behavior would likely be better served by having to opt into it more explicitly with a call like `doesNotContainMatch("(?s)^.*something.*$")`. Unfortunately, even that is likely to lead to misuse: If users omit `(?s)`, then `.` does not match newlines, so any string with a newline will pass a test like `doesNotContainMatch("^.*something.*$")` :( Perhaps our regex methods would ideally have enabled `(?s)` by default. But then that would be different from the `Pattern`-accepting overloads. There is no great solution here.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.