Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

test for .into() fails

  • Loading branch information...
commit 5e7cdc0ac75de0997793f5306cec413680292c47 1 parent 9721352
@substack authored
View
0  test/advance.js 100755 → 100644
File mode changed
View
0  test/binary.js 100755 → 100644
File mode changed
View
0  test/binary_assign.js 100755 → 100644
File mode changed
View
0  test/binary_endianness.js 100755 → 100644
File mode changed
View
0  test/binary_event.js 100755 → 100644
File mode changed
View
48 test/binary_into.js
@@ -0,0 +1,48 @@
+// Check .into(), especially for object pollution
+var sys = require('sys');
+var Buffer = require('buffer').Buffer;
+var BufferList = require('bufferlist');
+var Binary = require('bufferlist/binary');
+
+exports.into = function (assert) {
+ var bList = new BufferList;
+ var tapped = false;
+
+ Binary(bList)
+ .getWord8('ones')
+ .into('frac', function () {
+ this
+ .getWord64be('64')
+ .getWord32be('32')
+ .getWord16be('16')
+ .getWord8('8')
+ })
+ .tap(function (vars) {
+ tapped = true;
+
+ assert.equal(vars.ones, 3);
+ assert.equal(vars.frac['64'], 73184615082362370);
+ assert.equal(vars.frac['32'], 50661385);
+ assert.equal(vars.frac['16'], 1801);
+ assert.equal(vars.frac['8'], 3);
+
+ assert.equal(
+ Object.keys(vars).sort().join(' '), 'frac ones',
+ 'object pollution with .into()'
+ )
+ })
+ .end()
+ ;
+
+ var buf = new Buffer(16);
+ var i = 0;
+ String(4 * Math.atan2(1,1)).split('').forEach(function (digit) {
+ if (digit != '.') {
+ buf[i++] = parseInt(digit,10);
+ }
+ });
+ bList.push(buf);
+
+ assert.ok(tapped, 'not tapped');
+};
+
View
0  test/binary_jump.js 100755 → 100644
File mode changed
View
0  test/binary_loop.js 100755 → 100644
File mode changed
View
0  test/client_server.js 100755 → 100644
File mode changed
View
0  test/event.js 100755 → 100644
File mode changed
View
0  test/join.js 100755 → 100644
File mode changed
Please sign in to comment.
Something went wrong with that request. Please try again.