diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-08-02 09:24:15 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-08-02 09:25:35 +0200 |
commit | a9a1a5dfa967356ffe733e36a010f472332b5fe7 (patch) | |
tree | 9b7238f9f03f27d8b5309f3ff347c8f7a71ce03a /AK/Tests | |
parent | 6560116b67caa927b80b9c8c737f3ec0619847f4 (diff) | |
download | serenity-a9a1a5dfa967356ffe733e36a010f472332b5fe7.zip |
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.
Diffstat (limited to 'AK/Tests')
-rw-r--r-- | AK/Tests/TestHashMap.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/AK/Tests/TestHashMap.cpp b/AK/Tests/TestHashMap.cpp index 1c17eab5ff..9daa7e494c 100644 --- a/AK/Tests/TestHashMap.cpp +++ b/AK/Tests/TestHashMap.cpp @@ -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) |