Skip to content

Commit

Permalink
Test user specified callback to wrapped module.
Browse files Browse the repository at this point in the history
Closes #86.
  • Loading branch information
flatheadmill committed May 26, 2014
1 parent 836ae7f commit 2060cc9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
3 changes: 3 additions & 0 deletions release.md
@@ -0,0 +1,3 @@
### Issue by Issue

* Test user specified callback to wrapped module. #86.
6 changes: 4 additions & 2 deletions t/main/executable.t.js
@@ -1,11 +1,13 @@
#!/usr/bin/env node

require('proof')(1, function (ok, equal) {
require('proof')(2, function (ok, equal) {
var echo = require('./fixtures/echo')
var stream = require('stream')
var stdout = new stream.PassThrough
var chunks = []
stdout.on('data', function (data) { chunks.push(data.toString()) })
echo([ 'a', 'b' ], stdout)
echo([ 'a', 'b' ], stdout, null, null, function () {
ok(1, 'called back')
})
equal(chunks.join(''), 'a b\n', 'executable')
})
3 changes: 2 additions & 1 deletion t/main/fixtures/echo.js
Expand Up @@ -6,7 +6,7 @@
___ usage ___
*/

require('../../../executable')(module, function (options, stdout) {
require('../../../executable')(module, function (options, stdout, stderr, stdin, callback) {
if (options.argv.length) {
var separator = ''
options.argv.forEach(function (arg) {
Expand All @@ -16,4 +16,5 @@ require('../../../executable')(module, function (options, stdout) {
})
stdout.write('\n')
}
callback()
})

0 comments on commit 2060cc9

Please sign in to comment.