Browse Source

Don't access buffer data before initializing it.

Prevents valgrind from complaining and still tests that buffer data is
treated as unsigned.
v0.7.4-release
Tom Hughes 14 years ago
committed by Ryan Dahl
parent
commit
0d58353d66
  1. 4
      test/simple/test-buffer.js

4
test/simple/test-buffer.js

@ -8,8 +8,10 @@ var b = Buffer(1024); // safe constructor
console.log('b.length == ' + b.length); console.log('b.length == ' + b.length);
assert.strictEqual(1024, b.length); assert.strictEqual(1024, b.length);
b[0] = -1;
assert.equal(b[0], 255);
for (var i = 0; i < 1024; i++) { for (var i = 0; i < 1024; i++) {
assert.ok(b[i] >= 0);
b[i] = i % 256; b[i] = i % 256;
} }

Loading…
Cancel
Save