-
Notifications
You must be signed in to change notification settings - Fork 994
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
James Halliday
committed
Feb 1, 2011
1 parent
bf20782
commit 35473a4
Showing
2 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
var spawn = require('child_process').spawn; | ||
var assert = require('assert'); | ||
|
||
exports.dotSlashEmpty = function () { | ||
var to = setTimeout(function () { | ||
assert.fail('Never got stdout data.') | ||
}, 1000); | ||
|
||
var oldDir = process.cwd(); | ||
process.chdir(__dirname + '/_'); | ||
var bin = spawn('./bin.js'); | ||
process.chdir(oldDir); | ||
|
||
bin.stderr.on('data', assert.fail); | ||
bin.stdout.on('data', function (buf) { | ||
clearTimeout(to); | ||
var _ = JSON.parse(buf.toString()); | ||
assert.eql(_, []); | ||
}); | ||
}; | ||
|
||
exports.dotSlashArgs = function () { | ||
var to = setTimeout(function () { | ||
assert.fail('Never got stdout data.') | ||
}, 1000); | ||
|
||
var oldDir = process.cwd(); | ||
process.chdir(__dirname + '/_'); | ||
var bin = spawn('./bin.js', ['a','b','c']); | ||
process.chdir(oldDir); | ||
|
||
bin.stderr.on('data', assert.fail); | ||
bin.stdout.on('data', function (buf) { | ||
clearTimeout(to); | ||
var _ = JSON.parse(buf.toString()); | ||
assert.eql(_, ['a','b','c']); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env node | ||
var argv = require('optimist').argv | ||
console.log(JSON.stringify(argv._)); |