mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 21:19:50 +01:00
1948d37595
PR-URL: https://github.com/nodejs/node/pull/46599 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
35 lines
619 B
JavaScript
35 lines
619 B
JavaScript
'use strict';
|
|
|
|
require('../common');
|
|
const assert = require('assert');
|
|
const buffer = require('buffer');
|
|
|
|
const rangeErrorObjs = [NaN, -1];
|
|
const typeErrorObj = 'and even this';
|
|
|
|
for (const obj of rangeErrorObjs) {
|
|
assert.throws(
|
|
() => buffer.INSPECT_MAX_BYTES = obj,
|
|
{
|
|
code: 'ERR_OUT_OF_RANGE',
|
|
name: 'RangeError',
|
|
}
|
|
);
|
|
|
|
assert.throws(
|
|
() => buffer.INSPECT_MAX_BYTES = obj,
|
|
{
|
|
code: 'ERR_OUT_OF_RANGE',
|
|
name: 'RangeError',
|
|
}
|
|
);
|
|
}
|
|
|
|
assert.throws(
|
|
() => buffer.INSPECT_MAX_BYTES = typeErrorObj,
|
|
{
|
|
code: 'ERR_INVALID_ARG_TYPE',
|
|
name: 'TypeError',
|
|
}
|
|
);
|