mirror of https://gitee.com/openkylin/nodejs.git
20 lines
455 B
JavaScript
20 lines
455 B
JavaScript
// Flags: --expose-internals
|
|
'use strict';
|
|
require('../common');
|
|
const assert = require('assert');
|
|
const { sleep } = require('internal/util');
|
|
|
|
[undefined, null, '', {}, true, false].forEach((value) => {
|
|
assert.throws(
|
|
() => { sleep(value); },
|
|
/The "msec" argument must be of type number/
|
|
);
|
|
});
|
|
|
|
[-1, 3.14, NaN, 4294967296].forEach((value) => {
|
|
assert.throws(
|
|
() => { sleep(value); },
|
|
/The value of "msec" is out of range/
|
|
);
|
|
});
|