Skip to content

Commit

Permalink
test: use Number.isNaN instead of global isNaN
Browse files Browse the repository at this point in the history
PR-URL: #17515
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Anatoli Papirovski <[email protected]>
Reviewed-By: Jon Moss <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
  • Loading branch information
mithunsasidharan authored and MylesBorins committed Dec 12, 2017
1 parent 2a5da9c commit 1aae28b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion test/parallel/test-os.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const { inspect } = require('util');

const is = {
number: (value, key) => {
assert(!isNaN(value), `${key} should not be NaN`);
assert(!Number.isNaN(value), `${key} should not be NaN`);
assert.strictEqual(typeof value, 'number');
},
string: (value) => { assert.strictEqual(typeof value, 'string'); },
Expand Down
4 changes: 2 additions & 2 deletions test/parallel/test-readdouble.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ function test(clazz) {
buffer[5] = 0xff;
buffer[6] = 0x0f;
buffer[7] = 0x00;
assert.ok(isNaN(buffer.readDoubleBE(0)));
assert.ok(Number.isNaN(buffer.readDoubleBE(0)));
assert.strictEqual(2.225073858507201e-308, buffer.readDoubleLE(0));

buffer[6] = 0xef;
buffer[7] = 0x7f;
assert.ok(isNaN(buffer.readDoubleBE(0)));
assert.ok(Number.isNaN(buffer.readDoubleBE(0)));
assert.strictEqual(1.7976931348623157e+308, buffer.readDoubleLE(0));

buffer[0] = 0;
Expand Down
4 changes: 2 additions & 2 deletions test/parallel/test-writefloat.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ function test(clazz) {
// Darwin ia32 does the other kind of NaN.
// Compiler bug. No one really cares.
assert(0x7F === buffer[7] || 0xFF === buffer[7]);
assert.ok(isNaN(buffer.readFloatBE(0)));
assert.ok(isNaN(buffer.readFloatLE(4)));
assert.ok(Number.isNaN(buffer.readFloatBE(0)));
assert.ok(Number.isNaN(buffer.readFloatLE(4)));
}


Expand Down

0 comments on commit 1aae28b

Please sign in to comment.