diff options
author | Baruch <bmburstein@gmail.com> | 2022-09-14 18:46:21 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-14 18:46:21 (GMT) |
commit | 56070d8903bc7b9abbba952afa5e54209a08c0a2 (patch) | |
tree | 2b959ca7f37ea42cf89222b2d7b5c0249971a423 /docs | |
parent | dd969ed5fed68a518027ea1655579fa8768f3aae (diff) | |
parent | 1336c4b6d1a6f4bc6beebccb920e5ff858889292 (diff) | |
download | googletest-56070d8903bc7b9abbba952afa5e54209a08c0a2.zip googletest-56070d8903bc7b9abbba952afa5e54209a08c0a2.tar.gz googletest-56070d8903bc7b9abbba952afa5e54209a08c0a2.tar.bz2 |
Merge branch 'google:main' into custom_type_combine
Diffstat (limited to 'docs')
-rw-r--r-- | docs/gmock_cook_book.md | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/docs/gmock_cook_book.md b/docs/gmock_cook_book.md index 8a11d86..5be298d 100644 --- a/docs/gmock_cook_book.md +++ b/docs/gmock_cook_book.md @@ -1424,11 +1424,12 @@ Use `Pair` when comparing maps or other associative containers. {% raw %} ```cpp -using testing::ElementsAre; -using testing::Pair; +using ::testing::UnorderedElementsAre; +using ::testing::Pair; ... - std::map<string, int> m = {{"a", 1}, {"b", 2}, {"c", 3}}; - EXPECT_THAT(m, ElementsAre(Pair("a", 1), Pair("b", 2), Pair("c", 3))); + absl::flat_hash_map<string, int> m = {{"a", 1}, {"b", 2}, {"c", 3}}; + EXPECT_THAT(m, UnorderedElementsAre( + Pair("a", 1), Pair("b", 2), Pair("c", 3))); ``` {% endraw %} @@ -1445,8 +1446,8 @@ using testing::Pair; * If the container is passed by pointer instead of by reference, just write `Pointee(ElementsAre*(...))`. * The order of elements *matters* for `ElementsAre*()`. If you are using it - with containers whose element order are undefined (e.g. `hash_map`) you - should use `WhenSorted` around `ElementsAre`. + with containers whose element order are undefined (such as a + `std::unordered_map`) you should use `UnorderedElementsAre`. ### Sharing Matchers |