summaryrefslogtreecommitdiff
path: root/test/parallel/test-buffer-alloc.js
diff options
context:
space:
mode:
authorRuben Bridgewater <ruben@bridgewater.de>2018-02-10 02:33:08 +0100
committerRuben Bridgewater <ruben@bridgewater.de>2018-02-16 16:54:07 +0100
commit644fdd60d4be49ffa66d0bda1702c4459f607635 (patch)
tree70da98bc22a5a6c5bd0063e25d6eb729125706bf /test/parallel/test-buffer-alloc.js
parentcaee112e52b64f4bc1118c4a5fa5ad7b4211efea (diff)
downloadandroid-node-v8-644fdd60d4be49ffa66d0bda1702c4459f607635.tar.gz
android-node-v8-644fdd60d4be49ffa66d0bda1702c4459f607635.tar.bz2
android-node-v8-644fdd60d4be49ffa66d0bda1702c4459f607635.zip
test: minor refactoring
Add punctuation and comments about code that should not throw. Also remove a obsolete test and refactor some tests. PR-URL: https://github.com/nodejs/node/pull/18669 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Diffstat (limited to 'test/parallel/test-buffer-alloc.js')
-rw-r--r--test/parallel/test-buffer-alloc.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/test/parallel/test-buffer-alloc.js b/test/parallel/test-buffer-alloc.js
index 9714fcb485..bf818ed054 100644
--- a/test/parallel/test-buffer-alloc.js
+++ b/test/parallel/test-buffer-alloc.js
@@ -62,7 +62,7 @@ assert.throws(() => b.write('test', 'utf8', 0),
/is no longer supported/);
-// try to create 0-length buffers
+// Try to create 0-length buffers. Should not throw.
Buffer.from('');
Buffer.from('', 'ascii');
Buffer.from('', 'latin1');
@@ -107,7 +107,7 @@ b.copy(Buffer.alloc(1), 0, 2048, 2048);
assert.strictEqual(writeTest.toString(), 'nodejs');
}
-// Offset points to the end of the buffer
+// Offset points to the end of the buffer and does not throw.
// (see https://github.com/nodejs/node/issues/8127).
Buffer.alloc(1).write('', 1, 0);
@@ -992,10 +992,10 @@ common.expectsError(() => {
assert.strictEqual(ubuf.buffer.byteLength, 10);
}
-// Regression test
+// Regression test to verify that an empty ArrayBuffer does not throw.
Buffer.from(new ArrayBuffer());
-// Test that ArrayBuffer from a different context is detected correctly
+// Test that ArrayBuffer from a different context is detected correctly.
const arrayBuf = vm.runInNewContext('new ArrayBuffer()');
Buffer.from(arrayBuf);
Buffer.from({ buffer: arrayBuf });