summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorTrevor Norris <trev.norris@gmail.com>2013-05-20 12:35:31 -0700
committerTrevor Norris <trev.norris@gmail.com>2013-05-20 13:40:58 -0700
commitd5d5170c359fc96f36650cdd9b84cbb013c33735 (patch)
tree82d048b7fc9fffe3f7ddca5706e83c33943388e7 /test
parentf57ff787aafc0ac20b489acd1ec4dc9d09193000 (diff)
downloadnode-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.js4
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');