diff options
author | Rich Trott <rtrott@gmail.com> | 2017-03-23 16:27:02 -0700 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2017-03-28 11:31:10 -0700 |
commit | 682573c11dcd88b7d13f929884437de8415e3fed (patch) | |
tree | 6949bb8c413e130102a42768f79593080d81cd59 /test/parallel/test-buffer-fill.js | |
parent | a6f94942b0ff617e5788e26261e863f512d713e1 (diff) | |
download | android-node-v8-682573c11dcd88b7d13f929884437de8415e3fed.tar.gz android-node-v8-682573c11dcd88b7d13f929884437de8415e3fed.tar.bz2 android-node-v8-682573c11dcd88b7d13f929884437de8415e3fed.zip |
buffer: remove error for malformatted hex string
Remove error message when a hex string of an incorrect length is sent
to .write() or .fill().
PR-URL: https://github.com/nodejs/node/pull/12012
Fixes: https://github.com/nodejs/node/issues/3770
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michaƫl Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Diffstat (limited to 'test/parallel/test-buffer-fill.js')
-rw-r--r-- | test/parallel/test-buffer-fill.js | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/test/parallel/test-buffer-fill.js b/test/parallel/test-buffer-fill.js index 06a9044bec..46ebc79b62 100644 --- a/test/parallel/test-buffer-fill.js +++ b/test/parallel/test-buffer-fill.js @@ -132,11 +132,21 @@ testBufs('c8a26161', 8, 1, 'hex'); testBufs('61c8b462c8b563c8b6', 4, -1, 'hex'); testBufs('61c8b462c8b563c8b6', 4, 1, 'hex'); testBufs('61c8b462c8b563c8b6', 12, 1, 'hex'); -// Make sure this operation doesn't go on forever -buf1.fill('yKJh', 'hex'); -assert.throws(() => - buf1.fill('\u0222', 'hex'), /^TypeError: Invalid hex string$/); +{ + const buf = Buffer.allocUnsafe(SIZE); + assert.doesNotThrow(() => { + // Make sure this operation doesn't go on forever. + buf.fill('yKJh', 'hex'); + }); +} + +{ + const buf = Buffer.allocUnsafe(SIZE); + assert.doesNotThrow(() => { + buf.fill('\u0222', 'hex'); + }); +} // BASE64 testBufs('YWJj', 'ucs2'); |