-
Notifications
You must be signed in to change notification settings - Fork 13k
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
[libc++][NFC] Make AssertionInfoMatcher::CheckMessageMatches Stricter #77721
Conversation
Rather than allow for a message to be considered a match for the actual assertion if it is anywhere in the assertion text, make sure that the expected and the actual assertion are identical.
@llvm/pr-subscribers-libcxx Author: Will Hawkins (hawkinsw) ChangesRather than allow for a message to be considered a match for the actual assertion if it is anywhere in the assertion text, make sure that the expected and the actual assertion are identical. Addresses #77701 Full diff: https://github.com/llvm/llvm-project/pull/77721.diff 1 Files Affected:
diff --git a/libcxx/test/support/check_assertion.h b/libcxx/test/support/check_assertion.h
index 98dd95b11556e6..01e296d9138d0c 100644
--- a/libcxx/test/support/check_assertion.h
+++ b/libcxx/test/support/check_assertion.h
@@ -89,8 +89,7 @@ struct AssertionInfoMatcher {
std::size_t found_at = got_msg.find(msg_);
if (found_at == std::string_view::npos)
return false;
- // Allow any match
- return true;
+ return found_at == 0 && got_msg.size() == msg_.size();
}
private:
bool is_empty_;
|
Please feel free to ignore this change if it is unwanted. The tests that I ran locally all seem to pass with the stricter checking. I'll wait to see what it looks like on a full run of CI. |
…tricter Fix a few locations where matches were not precise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general I like this patch. However there seems to be unrelated changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am fine with this change if it passes CI (and without the unrelated changes). I thought we took advantage of this "hand wavyness" in more places, but if we don't and the CI is happy, I think this is an improvement.
…tricter Remove unrelated change.
Asking for another review from @mordante just out of caution! |
Pinging @var-const given his work on #77883. I will wait for his "go" before moving forward. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks LGTM! Let's ship it.
…llvm#77721) Rather than allow for a message to be considered a match for the actual assertion if it is anywhere in the assertion text, make sure that the expected and the actual assertion are identical. Addresses llvm#77701
Rather than allow for a message to be considered a match for the actual assertion if it is anywhere in the assertion text, make sure that the expected and the actual assertion are identical.
Addresses #77701