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

Commit

Permalink
test: update new tests to work with Node-ChakraCore
Browse files Browse the repository at this point in the history
  • Loading branch information
jackhorton committed Mar 5, 2018
1 parent 38d2724 commit 979e36a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
4 changes: 3 additions & 1 deletion test/parallel/test-buffer-fill.js
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,9 @@ common.expectsError(() => {
if (common.isChakraEngine) {
// Skip on ChakraCore due to TypedArray .length JIT bug
// (see this issue: https://github.com/Microsoft/ChakraCore/issues/2319)
throw new RangeError('Index out of range');
const err = new RangeError('Index out of range');
err.code = 'ERR_INDEX_OUT_OF_RANGE';
throw err;
}
const buf = new Buffer('w00t');
Object.defineProperty(buf, 'length', {
Expand Down
15 changes: 11 additions & 4 deletions test/parallel/test-buffer-writedouble.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,17 @@ assert.strictEqual(buffer.readDoubleLE(8), -Infinity);
buffer.writeDoubleBE(NaN, 0);
buffer.writeDoubleLE(NaN, 8);

assert.ok(buffer.equals(new Uint8Array([
0x7F, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0x7F
])));
if (process.jsEngine === 'chakracore') {
assert.ok(buffer.equals(new Uint8Array([
0xFF, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0xFF
])));
} else {
assert.ok(buffer.equals(new Uint8Array([
0x7F, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0x7F
])));
}

assert.ok(Number.isNaN(buffer.readDoubleBE(0)));
assert.ok(Number.isNaN(buffer.readDoubleLE(8)));
Expand Down
2 changes: 2 additions & 0 deletions test/parallel/test-buffer-writefloat.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ assert.strictEqual(buffer.readFloatLE(4), -Infinity);
buffer.writeFloatBE(NaN, 0);
buffer.writeFloatLE(NaN, 4);
assert.ok(buffer.equals(
process.jsEngine === 'chakracore' ?
new Uint8Array([ 0xFF, 0xC0, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xFF ]) :
new Uint8Array([ 0x7F, 0xC0, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x7F ])));

assert.ok(Number.isNaN(buffer.readFloatBE(0)));
Expand Down

0 comments on commit 979e36a

Please sign in to comment.