diff options
author | Chad Austin <chad@imvu.com> | 2014-05-08 14:53:04 -0700 |
---|---|---|
committer | Bruce Mitchener <bruce.mitchener@gmail.com> | 2014-05-21 22:58:47 +0700 |
commit | ec70dcb7bc76221949c057b5284c256d9959579a (patch) | |
tree | 99edbc17ad1067084f1b4d101c5e3e7e28148e17 /tests | |
parent | 416a5a9715928eb56770bf1f60d735c80ea07155 (diff) |
Call __destruct on the JS implementation when the instance is destroyed.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/embind/embind.test.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/embind/embind.test.js b/tests/embind/embind.test.js index a1d54a09..e77a8a43 100644 --- a/tests/embind/embind.test.js +++ b/tests/embind/embind.test.js @@ -1768,6 +1768,24 @@ module({ assert.equal("hi", rv); }); + test("__destruct is called when object is destroyed", function() { + var parent = cm.HeldAbstractClass; + var calls = []; + var C = parent.extend("C", { + method: function() { + }, + __destruct: function() { + calls.push("__destruct"); + } + }); + var impl = new C; + var copy = impl.clone(); + impl.delete(); + assert.deepEqual([], calls); + copy.delete(); + assert.deepEqual(["__destruct"], calls); + }); + /* does not pass yet test("if JavaScript implementation of interface is returned, don't wrap in new handle", function() { var parent = cm.HeldAbstractClass; |