Skip to content
This repository was archived by the owner on Oct 15, 2020. It is now read-only.

Commit 979e36a

Browse files
committed
test: update new tests to work with Node-ChakraCore
1 parent 38d2724 commit 979e36a

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

test/parallel/test-buffer-fill.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,9 @@ common.expectsError(() => {
371371
if (common.isChakraEngine) {
372372
// Skip on ChakraCore due to TypedArray .length JIT bug
373373
// (see this issue: https://github.com/Microsoft/ChakraCore/issues/2319)
374-
throw new RangeError('Index out of range');
374+
const err = new RangeError('Index out of range');
375+
err.code = 'ERR_INDEX_OUT_OF_RANGE';
376+
throw err;
375377
}
376378
const buf = new Buffer('w00t');
377379
Object.defineProperty(buf, 'length', {

test/parallel/test-buffer-writedouble.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,17 @@ assert.strictEqual(buffer.readDoubleLE(8), -Infinity);
6767
buffer.writeDoubleBE(NaN, 0);
6868
buffer.writeDoubleLE(NaN, 8);
6969

70-
assert.ok(buffer.equals(new Uint8Array([
71-
0x7F, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
72-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0x7F
73-
])));
70+
if (process.jsEngine === 'chakracore') {
71+
assert.ok(buffer.equals(new Uint8Array([
72+
0xFF, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
73+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0xFF
74+
])));
75+
} else {
76+
assert.ok(buffer.equals(new Uint8Array([
77+
0x7F, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
78+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0x7F
79+
])));
80+
}
7481

7582
assert.ok(Number.isNaN(buffer.readDoubleBE(0)));
7683
assert.ok(Number.isNaN(buffer.readDoubleLE(8)));

test/parallel/test-buffer-writefloat.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ assert.strictEqual(buffer.readFloatLE(4), -Infinity);
5151
buffer.writeFloatBE(NaN, 0);
5252
buffer.writeFloatLE(NaN, 4);
5353
assert.ok(buffer.equals(
54+
process.jsEngine === 'chakracore' ?
55+
new Uint8Array([ 0xFF, 0xC0, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xFF ]) :
5456
new Uint8Array([ 0x7F, 0xC0, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x7F ])));
5557

5658
assert.ok(Number.isNaN(buffer.readFloatBE(0)));

0 commit comments

Comments
 (0)