PATH:
usr
/
local
/
lib
/
node_modules
/
bower
/
lib
/
node_modules
/
binary
/
test
var binary = require('../'); var test = require('tap').test; var EventEmitter = require('events').EventEmitter; test('into stream', function (t) { t.plan(3); var digits = [ 1, 2, 3, 4, 5, 6 ]; var stream = new EventEmitter; var iv = setInterval(function () { var d = digits.shift(); if (d) stream.emit('data', new Buffer([ d ])) else clearInterval(iv) }, 20); binary.stream(stream) .into('moo', function () { this .word8('x') .word8('y') .word8('z') ; }) .tap(function (vars) { t.same(vars, { moo : { x : 1, y : 2, z : 3 } }); }) .word8('w') .tap(function (vars) { t.same(vars, { moo : { x : 1, y : 2, z : 3 }, w : 4, }); }) .word8('x') .tap(function (vars) { t.same(vars, { moo : { x : 1, y : 2, z : 3 }, w : 4, x : 5, }); }) ; });
[-] loop.js
[edit]
[-] peek.js
[edit]
[-] immediate.js
[edit]
[-] posbs.js
[edit]
[-] dots.js
[edit]
[-] negls.js
[edit]
[-] not_enough_buf.js
[edit]
[-] scan.js
[edit]
[+]
..
[-] split.js
[edit]
[-] posls.js
[edit]
[-] loop_scan.js
[edit]
[-] deferred.js
[edit]
[-] negbs.js
[edit]
[-] interval.js
[edit]
[-] skip.js
[edit]
[-] not_enough_parse.js
[edit]
[-] into_stream.js
[edit]
[-] parse.js
[edit]
[-] pipe.js
[edit]
[-] bu.js
[edit]
[-] lu.js
[edit]
[-] scan_buf_null.js
[edit]
[-] nested.js
[edit]
[-] flush.js
[edit]
[-] from_buffer.js
[edit]
[-] eof.js
[edit]
[-] get_buffer.js
[edit]
[-] into_buffer.js
[edit]
[-] scan_buf.js
[edit]