aboutsummaryrefslogtreecommitdiffstats
path: root/node_modules/spawn-command/test/spawn-command-test.js
blob: f74739ad507278cacd28fb296c8d195ed7e93f3d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
var path = require('path'),
    assert = require('assert'),
    assertCalled = require('assert-called'),
    spawnCommand = require('../');

var win32 = (process.platform === 'win32'),
    newln = win32 ? '\r\n' : '\n',
    grep = win32 ? 'findstr' : 'grep',
    child = spawnCommand(grep + ' commit < ' + path.join(__dirname, 'fixtures', 'commit')),
    stderr = '',
    stdout = '',
    exited = false;

child.stdout.on('data', function (chunk) {
  stdout += chunk;
});

child.stderr.on('data', function (chunk) {
  stderr += chunk;
});

child.on('exit', assertCalled(function (exitCode) {
  assert.equal(exitCode, 0);
  assert.equal(stdout, 'commit 26b11915b1c16440468a4b5f4b07d2409b98c68c' + newln);
  assert.equal(stderr, '');
}));
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage