Permalink
Browse files

Added tests/args/commands to test sub-commands

for narwhal/args.

Updated tests/args to call tests/args/commands.
  • Loading branch information...
1 parent b39f41d commit 66fbfdd2b99d366b51c878e66249c085d0b1b527 @abhinav abhinav committed Aug 8, 2010
Showing with 19 additions and 0 deletions.
  1. +1 −0 tests/args.js
  2. +18 −0 tests/args/commands.js
View
1 tests/args.js
@@ -27,6 +27,7 @@ exports.testDomain = require("./args/domain");
exports.testShifting = require("./args/shifting");
exports.testChoices = require("./args/choices");
exports.testActions = require("./args/actions");
+exports.testCommands = require("./args/commands");
if (require.main == module.id)
require("os").exit(require("test/runner").run(exports));
View
18 tests/args/commands.js
@@ -0,0 +1,18 @@
+
+// -- abhinav Abhinav Gupta Copyright (C) 2009-2010 MIT License
+
+var assert = require("assert");
+var test = require("../args");
+
+exports['test command'] = function () {
+ var parser = new test.Parser();
+
+ var called = false;
+ parser.command('list', function () { called = true });
+
+ parser.parse(['c', 'list', 'other']);
+ assert.ok(called, "given command should be called");
+};
+
+if (require.main == module.id)
+ require("os").exit(require("test").run(exports));

0 comments on commit 66fbfdd

Please sign in to comment.