Skip to content

Commit

Permalink
v8: add a js class for Serializer/Dserializer
Browse files Browse the repository at this point in the history
Calling Serializer/Deserlizer without new crashes node.
Adding a js class which just inherits cpp bindings.
Added refression tests.

Fixes: nodejs#13326
  • Loading branch information
zimbabao committed Jun 8, 2017
1 parent 90c50a6 commit e09951d
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions test/parallel/test-v8-serdes.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,17 +133,19 @@ const objects = [
}

{
try {
v8.Serializer();
} catch (e) {
const m = "Class constructor Serializer cannot be invoked without 'new'";
assert.strictEqual(e.message, m);
}

try {
v8.Deserializer();
} catch (e) {
const m = "Class constructor Deserializer cannot be invoked without 'new'";
assert.strictEqual(e.message, m);
}
assert.throws(
() => {
v8.Serializer();
},
Error,
"Class constructor Serializer cannot be invoked without 'new'"
);

assert.throws(
() => {
v8.Derializer();
},
Error,
"Class constructor Deserializer cannot be invoked without 'new'"
);
}

0 comments on commit e09951d

Please sign in to comment.