From cbee49cb7e62f19ea44a66c08a9bc9661bc702a5 Mon Sep 17 00:00:00 2001 From: Jesse Tane Date: Sun, 7 Dec 2014 13:26:34 -0500 Subject: [PATCH] add failing test for writing partial utf16 code units --- test/utf16.js | 9 +++++++++ 1 file changed, 9 insertions(+) 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() +}) -- 2.34.1