From 5700fc86844e2b6860bfbc2dbfa4be26e1c8fd7c Mon Sep 17 00:00:00 2001 From: Karl Cheng Date: Sun, 9 Apr 2017 22:43:53 +1000 Subject: [PATCH] test: fix allocUnsafe uninitialized buffer check Fixes parallel/test-buffer-bindingobj-no-zerofill to properly check that buffers created with `Buffer.allocUnsafe()` are not zero-filled. The test introduced in #11706 passes even if the buffer has been zero-filled and fails if none of the buffer values are zero. Signed-off-by: Karl Cheng Refs: https://github.com/nodejs/node/pull/11706 --- test/parallel/test-buffer-bindingobj-no-zerofill.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-buffer-bindingobj-no-zerofill.js b/test/parallel/test-buffer-bindingobj-no-zerofill.js index a9168713584e33..be89c99d67b544 100644 --- a/test/parallel/test-buffer-bindingobj-no-zerofill.js +++ b/test/parallel/test-buffer-bindingobj-no-zerofill.js @@ -44,7 +44,7 @@ const monkeyPatchedBuffer = require('../../lib/buffer'); // possible that a segment of memory is already zeroed out, so try again and // again until we succeed or we time out. let uninitialized = buffer.Buffer.allocUnsafe(1024); -while (uninitialized.some((val) => val !== 0)) +while (uninitialized.every((val) => val === 0)) uninitialized = buffer.Buffer.allocUnsafe(1024); // On monkeypatched buffer, zeroFill property is undefined. allocUnsafe() should