aboutsummaryrefslogtreecommitdiff
path: root/tests/embind/embind.test.js
diff options
context:
space:
mode:
authorJukka Jylanki <jjylanki@imvu.com>2013-05-07 16:50:14 +0300
committerChad Austin <chad@imvu.com>2013-05-17 12:57:45 -0700
commitaf3c155db90051d9772ed2a1cc29f9701f7a9c6c (patch)
tree546c03e95180bbe3cac6f3eff21b9883ec551b1e /tests/embind/embind.test.js
parent45a122b5d045abfc6d927329aedba79ae465373a (diff)
Add new unit tests to ensure that the return values of interfaces implemented in JS don't leak memory.
Diffstat (limited to 'tests/embind/embind.test.js')
-rw-r--r--tests/embind/embind.test.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/embind/embind.test.js b/tests/embind/embind.test.js
index f9f035f2..0c4dc174 100644
--- a/tests/embind/embind.test.js
+++ b/tests/embind/embind.test.js
@@ -1559,6 +1559,28 @@ module({
impl.delete();
});
+ test("returning null shared pointer from interfaces implemented in JS code does not leak", function() {
+ var impl = cm.AbstractClass.implement({
+ returnsSharedPtr: function() {
+ return null;
+ }
+ });
+ cm.callReturnsSharedPtrMethod(impl);
+ impl.delete();
+ // Let the memory leak test superfixture check that no leaks occurred.
+ });
+
+ test("returning a new shared pointer from interfaces implemented in JS code does not leak", function() {
+ var impl = cm.AbstractClass.implement({
+ returnsSharedPtr: function() {
+ return cm.embind_test_return_smart_derived_ptr();
+ }
+ });
+ cm.callReturnsSharedPtrMethod(impl);
+ impl.delete();
+ // Let the memory leak test superfixture check that no leaks occurred.
+ });
+
test("void methods work", function() {
var saved = {};
var impl = cm.AbstractClass.implement({