summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/core/managed/ManagedContainerTest.cpp30
1 files changed, 29 insertions, 1 deletions
diff --git a/test/core/managed/ManagedContainerTest.cpp b/test/core/managed/ManagedContainerTest.cpp
index a2f7aa6..c34541a 100644
--- a/test/core/managed/ManagedContainerTest.cpp
+++ b/test/core/managed/ManagedContainerTest.cpp
@@ -220,6 +220,35 @@ TEST(ManagedVector, moveWithNewOwner)
}
}
+class TestManagedWithContainer : public Managed {
+
+public:
+ ManagedVector<TestManaged> elems;
+
+ TestManagedWithContainer(Manager &mgr) : Managed(mgr), elems(this) {};
+
+};
+
+TEST(ManagedVector, embedded) {
+ // Note: This test depends on the correct deletion order -- otherwise
+ // valgrind shows an error
+ bool a;
+ Manager mgr(1);
+ {
+ Rooted<TestManagedWithContainer> a1{new TestManagedWithContainer(mgr)};
+ {
+ Rooted<TestManaged> a2{new TestManaged(mgr, a)};
+
+ ASSERT_TRUE(a);
+
+ a1->elems.push_back(a2);
+ }
+ ASSERT_TRUE(a);
+ }
+ ASSERT_FALSE(a);
+}
+
+
TEST(ManagedMap, managedMap)
{
// TODO: This test is highly incomplete
@@ -270,6 +299,5 @@ TEST(ManagedMap, managedMap)
}
}
-
}