mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 09:51:57 -05:00
AK: Add a test for iterating a HashTable during clear (should assert)
Ideally we should also verify that the assertion actually happens, but we need some support in the TestSuite framework for that.
This commit is contained in:
parent
6560116b67
commit
a9a1a5dfa9
1 changed files with 14 additions and 0 deletions
|
@ -62,4 +62,18 @@ TEST_CASE(case_insensitive)
|
|||
EXPECT_EQ(casemap.size(), 1);
|
||||
}
|
||||
|
||||
TEST_CASE(assert_on_iteration_during_clear)
|
||||
{
|
||||
struct Object {
|
||||
~Object()
|
||||
{
|
||||
m_map->begin();
|
||||
}
|
||||
HashMap<int, Object>* m_map;
|
||||
};
|
||||
HashMap<int, Object> map;
|
||||
map.set(0, { &map });
|
||||
map.clear();
|
||||
}
|
||||
|
||||
TEST_MAIN(HashMap)
|
||||
|
|
Loading…
Add table
Reference in a new issue