mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
dbfe8c4ea2
PR-URL: https://github.com/nodejs/node/pull/13976 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
22 lines
472 B
JavaScript
22 lines
472 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
|
|
assert.doesNotThrow(function() {
|
|
Buffer.allocUnsafe(10);
|
|
});
|
|
|
|
const err = common.expectsError({
|
|
code: 'ERR_INVALID_ARG_TYPE',
|
|
type: TypeError,
|
|
message: 'The "value" argument must not be of type number. ' +
|
|
'Received type number'
|
|
});
|
|
assert.throws(function() {
|
|
Buffer.from(10, 'hex');
|
|
}, err);
|
|
|
|
assert.doesNotThrow(function() {
|
|
Buffer.from('deadbeaf', 'hex');
|
|
});
|