1 var test = require('tap').test;
2 var promzard = require('../');
4 var file = __dirname + '/fn.input';
11 y : '/tmp/y/file.txt',
14 expect.a_function = fs.readFileSync(file, 'utf8')
15 expect.asyncPrompt = 'async prompt'
17 if (process.argv[2] === 'child') {
21 test('prompt callback param', function (t) {
24 var spawn = require('child_process').spawn
25 var child = spawn(process.execPath, [__filename, 'child'])
28 child.stderr.on('data', function (c) {
32 child.on('close', function () {
33 console.error('output=%j', output)
34 output = JSON.parse(output)
35 t.same(output, expect);
39 setTimeout(function () {
40 child.stdin.write('\n')
42 setTimeout(function () {
43 child.stdin.write('55\n')
45 setTimeout(function () {
46 child.stdin.end('async prompt\n')
51 var ctx = { tmpdir : '/tmp' }
52 var file = __dirname + '/fn.input';
53 promzard(file, ctx, function (err, output) {
54 console.error(JSON.stringify(output))