diff options
author | Feross Aboukhadijeh <feross@feross.org> | 2014-09-17 07:48:04 +0400 |
---|---|---|
committer | Feross Aboukhadijeh <feross@feross.org> | 2014-09-17 07:48:04 +0400 |
commit | 3dde5246201459e9bb4be7a4f6e9b0c7d84a30f1 (patch) | |
tree | cc33445371962b1490a543e8bcd446cdc507f87b /test | |
parent | eb0321e9f900787af6fe77f07f0ccc52bfdc5e9e (diff) |
command line: add test for -v --version flags
for #94
Diffstat (limited to 'test')
-rw-r--r-- | test/basic.js | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/test/basic.js b/test/basic.js index 0013650..0801452 100644 --- a/test/basic.js +++ b/test/basic.js @@ -16,10 +16,29 @@ test('Module usage (sanity check)', function (t) { }) }) -test('Command line usage (sanity check)', function (t) { +test('Command line: --help', function (t) { + t.plan(2) + var bin = __dirname + '/../bin/cmd.js --help' - cp.exec(bin, function (err) { + cp.exec(bin, function (err, data) { t.error(err) // no error, exit code 0 - t.end() + t.ok(data.indexOf('usage') !== 0) + }) +}) + +test('Command line: -v --version', function (t) { + t.plan(4) + var expectedVersion = require(__dirname + '/../package.json').version + '\n' + + var bin = __dirname + '/../bin/cmd.js --version' + cp.exec(bin, function (err, data) { + t.error(err) // no error, exit code 0 + t.equal(data, expectedVersion) + }) + + bin = __dirname + '/../bin/cmd.js -v' + cp.exec(bin, function (err, data) { + t.error(err) // no error, exit code 0 + t.equal(data, expectedVersion) }) }) |