From 0d58353d66290c7138d5e96829e722772f8ca452 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Mon, 20 Dec 2010 11:15:20 -0600 Subject: [PATCH] Don't access buffer data before initializing it. Prevents valgrind from complaining and still tests that buffer data is treated as unsigned. --- test/simple/test-buffer.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/simple/test-buffer.js b/test/simple/test-buffer.js index 818e98cc0ee..e8756a7db4f 100644 --- a/test/simple/test-buffer.js +++ b/test/simple/test-buffer.js @@ -8,8 +8,10 @@ var b = Buffer(1024); // safe constructor console.log('b.length == ' + b.length); assert.strictEqual(1024, b.length); +b[0] = -1; +assert.equal(b[0], 255); + for (var i = 0; i < 1024; i++) { - assert.ok(b[i] >= 0); b[i] = i % 256; }