diff options
author | Trevor Norris <trev.norris@gmail.com> | 2013-05-20 12:35:31 -0700 |
---|---|---|
committer | Trevor Norris <trev.norris@gmail.com> | 2013-05-20 13:40:58 -0700 |
commit | d5d5170c359fc96f36650cdd9b84cbb013c33735 (patch) | |
tree | 82d048b7fc9fffe3f7ddca5706e83c33943388e7 /test | |
parent | f57ff787aafc0ac20b489acd1ec4dc9d09193000 (diff) | |
download | node-d5d5170c359fc96f36650cdd9b84cbb013c33735.tar.gz |
string_bytes: strip padding from base64 strings
Because of variations in different base64 implementation, it's been
decided to strip all padding from the end of a base64 string and
calculate its size from that.
Diffstat (limited to 'test')
-rw-r--r-- | test/simple/test-buffer.js | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/test/simple/test-buffer.js b/test/simple/test-buffer.js index 20a6bdba9..3808442ad 100644 --- a/test/simple/test-buffer.js +++ b/test/simple/test-buffer.js @@ -980,6 +980,10 @@ assert.throws(function() { } })(); +// Make sure byteLength properly checks for base64 padding +assert.equal(Buffer.byteLength('aaa=', 'base64'), 2); +assert.equal(Buffer.byteLength('aaaa==', 'base64'), 3); + // Regression test for #5482: should throw but not assert in C++ land. assert.throws(function() { Buffer('', 'buffer'); |