Skip to content

Commit

Permalink
Add assert covering Buffer.from with whitespaced hex
Browse files Browse the repository at this point in the history
  • Loading branch information
LinusU committed Jan 23, 2024
1 parent 4872524 commit f3559d7
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions test/node/test-buffer-badhex.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const assert = require('assert');
assert.strictEqual(buf.write('abc def01', 0, 'hex'), 1);
assert.deepStrictEqual(buf, new Buffer([0xab, 0, 0, 0]));
assert.strictEqual(buf.toString('hex'), 'ab000000');
assert.deepStrictEqual(Buffer.from('abc def01', 'hex'), Buffer.from([0xab]));

const copy = Buffer.from(buf.toString('hex'), 'hex');
assert.strictEqual(buf.toString('hex'), copy.toString('hex'));
Expand Down

0 comments on commit f3559d7

Please sign in to comment.