diff options
author | Chad Austin <chad@imvu.com> | 2014-05-09 13:20:58 -0700 |
---|---|---|
committer | Bruce Mitchener <bruce.mitchener@gmail.com> | 2014-05-21 22:59:16 +0700 |
commit | 09b00f5cd39dc986bc5797c5eb9920af04b4ac59 (patch) | |
tree | 3ef7f74426e0ce45b8211498b5145f26ac79521f /tests/embind/embind.test.js | |
parent | e25a0f0af05a12705bacf35e4d94bcdc9cd334e9 (diff) |
Prevent some common mistakes when calling parent constructors and destructors
Diffstat (limited to 'tests/embind/embind.test.js')
-rw-r--r-- | tests/embind/embind.test.js | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/embind/embind.test.js b/tests/embind/embind.test.js index bc0a6154..067b3f60 100644 --- a/tests/embind/embind.test.js +++ b/tests/embind/embind.test.js @@ -1800,6 +1800,35 @@ module({ rv.delete(); }); + test("can instantiate two wrappers with constructors", function() { + var parent = cm.HeldAbstractClass; + var C = parent.extend("C", { + __construct: function() { + this.__parent.__construct.call(this); + }, + method: function() { + } + }); + var a = new C; + var b = new C; + a.delete(); + b.delete(); + }); + + test("incorrectly calling parent is an error", function() { + var parent = cm.HeldAbstractClass; + var C = parent.extend("C", { + __construct: function() { + this.__parent.__construct(); + }, + method: function() { + } + }); + assert.throws(cm.BindingError, function() { + new C; + }); + }); + test("deleteLater() works for JavaScript implementations", function() { var parent = cm.HeldAbstractClass; var C = parent.extend("C", { |