From 9b0539336293d12fe30043688a1ef2fd32ca9bf5 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Mon, 3 Apr 2017 14:51:16 +0200 Subject: [PATCH] test: fix V8 test on big-endian machines MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ref: https://github.com/nodejs/node/pull/12143#issuecomment-291131159 PR-URL: https://github.com/nodejs/node/pull/12186 Reviewed-By: Gibson Fahnestock Reviewed-By: Michael Dawson Reviewed-By: Michaƫl Zasso Reviewed-By: Colin Ihrig --- test/parallel/test-v8-serdes.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-v8-serdes.js b/test/parallel/test-v8-serdes.js index 1914375ba2ec58..d3a879fc225353 100644 --- a/test/parallel/test-v8-serdes.js +++ b/test/parallel/test-v8-serdes.js @@ -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; @@ -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); }