From: Jesse Tane Date: Sun, 7 Dec 2014 18:26:34 +0000 (-0500) Subject: add failing test for writing partial utf16 code units X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=cbee49cb7e62f19ea44a66c08a9bc9661bc702a5;p=buffer.git add failing test for writing partial utf16 code units --- diff --git a/test/utf16.js b/test/utf16.js index 5462d0e..73349a0 100644 --- a/test/utf16.js +++ b/test/utf16.js @@ -33,3 +33,12 @@ test('throw on orphaned utf16 surrogate trail code point', function(t) { t.equal(err instanceof URIError, true) t.end() }) + +test('do not write partial utf16 code units', function(t) { + var f = new B([0, 0, 0, 0, 0]) + t.equal(f.length, 5) + var size = f.write('あいうえお', 'utf16le') + t.equal(size, 4) + t.deepEqual(f, new B([0x42, 0x30, 0x44, 0x30, 0x00])) + t.end() +})