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:
Andreas Kling 2019-08-02 09:24:15 +02:00
parent 6560116b67
commit a9a1a5dfa9

View file

@ -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)