diff options
author | Konstantin Käfer <github@kkaefer.com> | 2011-02-06 15:49:52 -0500 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2011-02-07 13:35:06 -0800 |
commit | 9e101f2b01ccec3653a3894cb79c1267c45b2df3 (patch) | |
tree | c788241dfb1651e356a92ece67c63041416be8cf /test | |
parent | bf8f4aa9661a3bbf19836369c758abe5fa7db762 (diff) | |
download | nodejs-9e101f2b01ccec3653a3894cb79c1267c45b2df3.tar.gz nodejs-9e101f2b01ccec3653a3894cb79c1267c45b2df3.tar.bz2 nodejs-9e101f2b01ccec3653a3894cb79c1267c45b2df3.zip |
UCS-2 support
Closes GH-644.
Diffstat (limited to 'test')
-rw-r--r-- | test/simple/test-buffer.js | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/test/simple/test-buffer.js b/test/simple/test-buffer.js index e8756a7db..176e5a463 100644 --- a/test/simple/test-buffer.js +++ b/test/simple/test-buffer.js @@ -225,6 +225,14 @@ var f = new Buffer('über', 'ascii'); console.error('f.length: %d (should be 4)', f.length); assert.deepEqual(f, new Buffer([252, 98, 101, 114])); +var f = new Buffer('über', 'ucs2'); +console.error('f.length: %d (should be 8)', f.length); +assert.deepEqual(f, new Buffer([252, 0, 98, 0, 101, 0, 114, 0])); + +var f = new Buffer('привет', 'ucs2'); +console.error('f.length: %d (should be 12)', f.length); +assert.deepEqual(f, new Buffer([63, 4, 64, 4, 56, 4, 50, 4, 53, 4, 66, 4])); +assert.equal(f.toString('ucs2'), 'привет'); // // Test toString('base64') @@ -386,9 +394,9 @@ assert.equal('bcde', b.slice(1).toString()); // byte length assert.equal(14, Buffer.byteLength('Il était tué')); assert.equal(14, Buffer.byteLength('Il était tué', 'utf8')); +assert.equal(24, Buffer.byteLength('Il était tué', 'ucs2')); assert.equal(12, Buffer.byteLength('Il était tué', 'ascii')); assert.equal(12, Buffer.byteLength('Il était tué', 'binary')); - // slice(0,0).length === 0 assert.equal(0, Buffer('hello').slice(0, 0).length); |