Skip to content

Commit

Permalink
test: fix V8 test on big-endian machines
Browse files Browse the repository at this point in the history
Ref: #12143 (comment)
PR-URL: #12186
Reviewed-By: Gibson Fahnestock <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
  • Loading branch information
addaleax committed Apr 3, 2017
1 parent 843b7e6 commit 9b05393
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions test/parallel/test-v8-serdes.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
const common = require('../common');
const assert = require('assert');
const v8 = require('v8');
const os = require('os');

const circular = {};
circular.circular = circular;
Expand Down Expand Up @@ -124,6 +125,9 @@ const objects = [
let buf = Buffer.alloc(32 + 9);
buf.write('ff0d5c0404addeefbe', 32, 'hex');
buf = buf.slice(32);
assert.deepStrictEqual(v8.deserialize(buf),
new Uint16Array([0xdead, 0xbeef]));

const expectedResult = os.endianness() === 'LE' ?
new Uint16Array([0xdead, 0xbeef]) : new Uint16Array([0xadde, 0xefbe]);

assert.deepStrictEqual(v8.deserialize(buf), expectedResult);
}

0 comments on commit 9b05393

Please sign in to comment.