Skip to content

Commit 882b4fc

Browse files
authored
[libc++][NFC] Make AssertionInfoMatcher::CheckMessageMatches Stricter (#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 #77701
1 parent b348126 commit 882b4fc

File tree

4 files changed

+4
-5
lines changed

4 files changed

+4
-5
lines changed

libcxx/test/libcxx/containers/views/mdspan/layout_left/assert.stride.pass.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ int main(int, char**) {
3535
{
3636
std::layout_left::mapping<std::dextents<int, 3>> m{std::dextents<int, 3>{100, 100, 100}};
3737

38-
TEST_LIBCPP_ASSERT_FAILURE(m.stride(4), "invalid rank index");
38+
TEST_LIBCPP_ASSERT_FAILURE(m.stride(4), "layout_left::mapping::stride(): invalid rank index");
3939
}
4040
return 0;
4141
}

libcxx/test/libcxx/containers/views/mdspan/layout_right/assert.stride.pass.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ int main(int, char**) {
3535
{
3636
std::layout_right::mapping<std::dextents<int, 3>> m{std::dextents<int, 3>{100, 100, 100}};
3737

38-
TEST_LIBCPP_ASSERT_FAILURE(m.stride(4), "invalid rank index");
38+
TEST_LIBCPP_ASSERT_FAILURE(m.stride(4), "layout_right::mapping::stride(): invalid rank index");
3939
}
4040
return 0;
4141
}

libcxx/test/libcxx/containers/views/mdspan/layout_stride/assert.stride.pass.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ int main(int, char**) {
3030
std::layout_stride::mapping<std::dextents<int, 3>> m(
3131
std::dextents<int, 3>(100, 100, 100), std::array<int, 3>{1, 100, 10000});
3232

33-
TEST_LIBCPP_ASSERT_FAILURE(m.stride(4), "invalid rank index");
33+
TEST_LIBCPP_ASSERT_FAILURE(m.stride(4), "layout_stride::mapping::stride(): invalid rank index");
3434
}
3535
return 0;
3636
}

libcxx/test/support/check_assertion.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,7 @@ struct AssertionInfoMatcher {
8989
std::size_t found_at = got_msg.find(msg_);
9090
if (found_at == std::string_view::npos)
9191
return false;
92-
// Allow any match
93-
return true;
92+
return found_at == 0 && got_msg.size() == msg_.size();
9493
}
9594
private:
9695
bool is_empty_;

0 commit comments

Comments
 (0)