Index: Source/wtf/HashMapTest.cpp |
diff --git a/Source/wtf/HashMapTest.cpp b/Source/wtf/HashMapTest.cpp |
index c808f483b1af62641bef594bf80b16f789da358a..6fe352e06ab685ad4be453f54e746d88b5a2c234 100644 |
--- a/Source/wtf/HashMapTest.cpp |
+++ b/Source/wtf/HashMapTest.cpp |
@@ -284,4 +284,22 @@ TEST(HashMapTest, AddResultVectorValue) |
EXPECT_EQ(11, map.find(1)->value.first()); |
} |
+class InstanceCounter { |
+public: |
+ InstanceCounter() { ++counter; } |
+ InstanceCounter(const InstanceCounter& another) { ++counter; } |
+ ~InstanceCounter() { --counter; } |
+ static int counter; |
+}; |
+int InstanceCounter::counter = 0; |
+ |
+TEST(HashMapTest, ValueTypeDestructed) |
+{ |
+ InstanceCounter::counter = 0; |
+ HashMap<int, InstanceCounter> map; |
+ map.set(1, InstanceCounter()); |
+ map.clear(); |
+ EXPECT_EQ(0, InstanceCounter::counter); |
+} |
+ |
} // namespace |