From abd94a7f5a50f43c797a11b53549ae48fff667c3 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Mon, 10 Oct 2016 03:43:44 +0200 Subject: add node_modules to address #4364 --- node_modules/nomnom/test/option.js | 44 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 node_modules/nomnom/test/option.js (limited to 'node_modules/nomnom/test/option.js') diff --git a/node_modules/nomnom/test/option.js b/node_modules/nomnom/test/option.js new file mode 100644 index 000000000..e3934d75e --- /dev/null +++ b/node_modules/nomnom/test/option.js @@ -0,0 +1,44 @@ +var nomnom = require("../nomnom"); + +var parser = nomnom() + .option('debug', { + abbr: 'x', + flag: true, + help: 'Print debugging info' + }) + .option('config', { + abbr: 'c', + default: 'config.json', + help: 'JSON file with tests to run' + }) + .option('version', { + flag: true, + help: 'print version and exit', + callback: function() { + return "version 1.2.4"; + } + }); + + +exports.testOption = function(test) { + var opts = parser.parse(["-x", "--no-verbose"]); + + test.strictEqual(opts.debug, true); + test.equal(opts.config, "config.json"); + test.done(); +} + + +exports.testCommandOption = function(test) { + var parser = nomnom() + parser.command('test') + .option('fruit', { + abbr: 'f', + flag: true + }) + + var opts = parser.parse(["test", "-f"]); + + test.strictEqual(opts.fruit, true); + test.done(); +} -- cgit v1.2.3