Browse Source

test: add coverage for utf8CheckIncomplete()

This commit adds code coverage to utf8CheckIncomplete(), when the
lastNeed is greater than buffer length.

PR-URL: https://github.com/nodejs/node/pull/11419
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
v6
xiaoyu 8 years ago
committed by Michaël Zasso
parent
commit
48f8869685
  1. 3
      test/parallel/test-string-decoder.js

3
test/parallel/test-string-decoder.js

@ -83,6 +83,9 @@ assert.strictEqual(decoder.write(Buffer.from('F1', 'hex')), '');
assert.strictEqual(decoder.write(Buffer.from('41F2', 'hex')), '\ufffdA');
assert.strictEqual(decoder.end(), '\ufffd');
// Additional utf8Text test
decoder = new StringDecoder('utf8');
assert.strictEqual(decoder.text(Buffer.from([0x41]), 2), '');
// Additional UTF-16LE surrogate pair tests
decoder = new StringDecoder('utf16le');

Loading…
Cancel
Save