diff options
author | Evan Brown <ezb@google.com> | 2023-02-14 12:30:41 -0800 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2023-02-14 12:31:43 -0800 |
commit | 15957950d997cd9e09c61add5200361d5d1e7e11 (patch) | |
tree | 14b8da124467d5b9399819b12fda697b600b2cd2 /absl/container/internal/raw_hash_set_test.cc | |
parent | ae2f0378dc0e8c10e1e12b6d866568682bde684c (diff) |
Make default-constructed swisstable iterators use EmptyGroup() for ctrl_ so that we can distinguish between end() iterators and default-constructed iterators in debug mode.
PiperOrigin-RevId: 509606271
Change-Id: I77b68590b3904a4cf7809b75d814d74cb89603b6
Diffstat (limited to 'absl/container/internal/raw_hash_set_test.cc')
-rw-r--r-- | absl/container/internal/raw_hash_set_test.cc | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/absl/container/internal/raw_hash_set_test.cc b/absl/container/internal/raw_hash_set_test.cc index f7ec1456..4f2d006d 100644 --- a/absl/container/internal/raw_hash_set_test.cc +++ b/absl/container/internal/raw_hash_set_test.cc @@ -2060,22 +2060,17 @@ TEST(TableDeathTest, InvalidIteratorAsserts) { IntTable t; // Extra simple "regexp" as regexp support is highly varied across platforms. - EXPECT_DEATH_IF_SUPPORTED( - t.erase(t.end()), - "erase.* called on invalid iterator. The iterator might be an " - "end.*iterator or may have been default constructed."); + EXPECT_DEATH_IF_SUPPORTED(t.erase(t.end()), + "erase.* called on end.. iterator."); typename IntTable::iterator iter; EXPECT_DEATH_IF_SUPPORTED( - ++iter, - "operator.* called on invalid iterator. The iterator might be an " - "end.*iterator or may have been default constructed."); + ++iter, "operator.* called on default-constructed iterator."); t.insert(0); iter = t.begin(); t.erase(iter); - EXPECT_DEATH_IF_SUPPORTED( - ++iter, - "operator.* called on invalid iterator. The element might have been " - "erased or .*the table might have rehashed."); + EXPECT_DEATH_IF_SUPPORTED(++iter, + "operator.* called on invalid iterator. The " + "element might have been erased"); } // Invalid iterator use can trigger heap-use-after-free in asan, @@ -2363,8 +2358,8 @@ TEST(Iterator, InvalidComparisonDifferentTables) { // from control bytes, then we could do so. // EXPECT_DEATH_IF_SUPPORTED(void(t1.end() == t2.end()), // "Invalid iterator comparison.*empty hashtable"); - // EXPECT_DEATH_IF_SUPPORTED(void(t1.end() == default_constructed_iter), - // "Invalid iterator comparison.*default-const..."); + EXPECT_DEATH_IF_SUPPORTED(void(t1.end() == default_constructed_iter), + "Invalid iterator comparison.*default-constructed"); t1.insert(0); EXPECT_DEATH_IF_SUPPORTED(void(t1.begin() == t2.end()), "Invalid iterator comparison.*empty hashtable"); |