Skip to content

Commit

Permalink
test: adapt test-v8-serdes for V8 9.9
Browse files Browse the repository at this point in the history
V8 changed the serialization format so we cannot expect that a value
serialized by an old version can be reserialized to the same bytes.
Change the test to expect that deserialization of the old value still
works.

Closes: #41519
  • Loading branch information
targos committed Mar 1, 2022
1 parent 3d9ca4b commit 4696a55
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions test/parallel/test-v8-serdes.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,18 +155,15 @@ const hostObject = new (internalBinding('js_stream').JSStream)();
}

{
// Test that an old serialized value can still be deserialized.
const buf = Buffer.from('ff0d6f2203666f6f5e007b01', 'hex');

const des = new v8.DefaultDeserializer(buf);
des.readHeader();

const ser = new v8.DefaultSerializer();
ser.writeHeader();

ser.writeValue(des.readValue());

assert.deepStrictEqual(buf, ser.releaseBuffer());
assert.strictEqual(des.getWireFormatVersion(), 0x0d);

const value = des.readValue();
assert.strictEqual(value, value.foo);
}

{
Expand Down

0 comments on commit 4696a55

Please sign in to comment.