summaryrefslogtreecommitdiff
path: root/test/parallel/test-string-decoder.js
diff options
context:
space:
mode:
authorxiaoyu <306766053@qq.com>2017-02-17 00:24:39 +0800
committerMichaël Zasso <targos@protonmail.com>2017-02-18 16:04:09 +0100
commit48f88696858bd353f3471c7c8b161b2e23f7660b (patch)
treec94aaf93c088932b50ad04934c46bb31eac6a2b3 /test/parallel/test-string-decoder.js
parenta1c652ae6043603776463986b529298f61df8323 (diff)
downloadandroid-node-v8-48f88696858bd353f3471c7c8b161b2e23f7660b.tar.gz
android-node-v8-48f88696858bd353f3471c7c8b161b2e23f7660b.tar.bz2
android-node-v8-48f88696858bd353f3471c7c8b161b2e23f7660b.zip
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>
Diffstat (limited to 'test/parallel/test-string-decoder.js')
-rw-r--r--test/parallel/test-string-decoder.js3
1 files changed, 3 insertions, 0 deletions
diff --git a/test/parallel/test-string-decoder.js b/test/parallel/test-string-decoder.js
index 4d22d670f6..78f3a48b60 100644
--- a/test/parallel/test-string-decoder.js
+++ b/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');