require('proof')(6, require('cadence')(prove))

function prove (async, assert) {
    var pumper = require('..')
    var Chunk = require('prolific.chunk')
    var events = require ('events')
    var stream = require('stream')
    var stderr = new stream.PassThrough
    async(function () {
        var child = new events.EventEmitter
        var io = {
            async: new stream.PassThrough,
            sync: new stream.PassThrough
        }
        pumper({
            process: function (entry) {
                assert(entry, {
                    formatted: null,
                    qualifier: [ null, 'bigeasy', 'bigeasy.prolific' ],
                    level: 0,
                    json: { qualifier: 'bigeasy.prolific', level: 'trace', a: 1 }
                 }, 'sender')
            }
        }, child, io, stderr, async())
        io.sync.write(new Buffer('hello, world\n'))
        var chunk = new Chunk(0, new Buffer(''), 1)
        io.async.write(chunk.header('aaaaaaaa'))
        io.async.write(chunk.buffer)
        var previousChecksum = chunk.checksum
        var buffer = new Buffer('{"qualifier":"bigeasy.prolific","level":"trace","a":1}\n')
        chunk = new Chunk(1, buffer, buffer.length)
        io.async.write(chunk.header(previousChecksum))
        io.async.write(chunk.buffer)
        previousChecksum = chunk.checksum
        buffer = new Buffer('{"qualifier":"bigeasy.prolific","level":"trace","a":1}\n')
        chunk = new Chunk(2, buffer, buffer.length)
        io.async.write(chunk.header(previousChecksum))
        io.async.write(chunk.buffer)
        io.async.emit('end')
        io.sync.emit('end')
        child.emit('exit', 0, null)
    }, function (code, configuration) {
        assert(code, 0, 'exit code')
        assert(stderr.read().toString(), 'hello, world\n', 'stderr')
        var child = new events.EventEmitter
        var io = {
            async: new stream.PassThrough,
            sync: new stream.PassThrough
        }
        pumper(null, child, io, stderr, async())
        child.emit('exit', null, 'SIGTERM')
        io.sync.emit('end')
        var error = new Error
        error.code = 'ECONNRESET'
        io.async.emit('error', error)
    }, function (code, configuration) {
        assert(code, 1, 'error exit code')
        assert(configuration, null, 'no configuration')
    })
}

@@ -528,16 +528,45 @@
 ntry, %7B%0A
+                    when: 0,%0A
         
@@ -594,16 +594,16 @@
 : null,%0A
-
         
@@ -723,16 +723,25 @@
  json: %7B
+ when: 0,
  qualifi
@@ -1133,32 +1133,41 @@
 = new Buffer('%7B%22
+when%22:0,%22
 qualifier%22:%22bige
@@ -1385,32 +1385,32 @@
  chunk.checksum%0A
-
         buffer =
@@ -1424,16 +1424,25 @@
 ffer('%7B%22
+when%22:0,%22
 qualifie

Test the hoisted `when`.