aboutsummaryrefslogtreecommitdiff
path: root/tests/embind/embind.test.js
diff options
context:
space:
mode:
authorChad Austin <chad@imvu.com>2013-08-29 13:39:54 -0700
committerBruce Mitchener <bruce.mitchener@gmail.com>2014-02-04 16:16:10 +0700
commit1511e68f617e555b5342fe9df693eed07ffac8cb (patch)
tree5c3611d9e2da0530e42b5f79edcd2b2caf21531c /tests/embind/embind.test.js
parent04b624f10d7f040e5e9551e9c956c4b0ca7c66b0 (diff)
Fix a possible memory corruption bug when using val::as
Diffstat (limited to 'tests/embind/embind.test.js')
-rw-r--r--tests/embind/embind.test.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/embind/embind.test.js b/tests/embind/embind.test.js
index da81a81e..ee80da0c 100644
--- a/tests/embind/embind.test.js
+++ b/tests/embind/embind.test.js
@@ -1888,6 +1888,18 @@ module({
sh.delete();
});
});
+
+ BaseFixture.extend("val::as from pointer to value", function() {
+ test("calling as on pointer with value makes a copy", function() {
+ var sh1 = new cm.StringHolder("Hello world");
+ var sh2 = cm.return_StringHolder_copy(sh1);
+ assert.equal("Hello world", sh1.get());
+ assert.equal("Hello world", sh2.get());
+ assert.false(sh1.isAliasOf(sh2));
+ sh2.delete();
+ sh1.delete();
+ });
+ });
});
/* global run_all_tests */