cli-argparse
Advanced tools
Comparing version
{ | ||
"name": "cli-argparse", | ||
"version": "0.3.4", | ||
"version": "0.3.5", | ||
"description": "Lightweight argument parser", | ||
@@ -5,0 +5,0 @@ "author": "muji <noop@xpm.io>", |
@@ -5,6 +5,17 @@ var expect = require('chai').expect; | ||
describe('cli-argparse:', function() { | ||
it('should coerce missing value to empty string (short)', function(done) { | ||
var args = ['-p=']; | ||
var result = parse(args); | ||
expect(result.options.p).to.be.a('string').that.equals(''); | ||
done(); | ||
}); | ||
it('should coerce missing value to empty string (long)', function(done) { | ||
var args = ['--port=']; | ||
var result = parse(args); | ||
expect(result.options.port).to.be.a('string').that.equals(''); | ||
done(); | ||
}); | ||
it('should parse long option (equality)', function(done) { | ||
var args = ['--port=80']; | ||
var result = parse(args); | ||
expect(result.raw).to.eql(args); | ||
expect(result.options.port).to.be.a('string').that.equals('80'); | ||
@@ -16,3 +27,2 @@ done(); | ||
var result = parse(args); | ||
expect(result.raw).to.eql(args); | ||
expect(result.options.p).to.be.a('string').that.equals('80'); | ||
@@ -25,3 +35,2 @@ done(); | ||
var result = parse(args); | ||
expect(result.raw).to.eql(args); | ||
expect(result.options.port).to.be.a('string').that.equals('80'); | ||
@@ -35,3 +44,2 @@ done(); | ||
var result = parse(args); | ||
expect(result.raw).to.eql(args); | ||
expect(result.options.port) | ||
@@ -46,3 +54,2 @@ .to.be.a('string').that.equals('variable=value'); | ||
var result = parse(args); | ||
expect(result.raw).to.eql(args); | ||
expect(result.options.port) | ||
@@ -58,3 +65,2 @@ .to.be.a('string').that.equals('variable=value'); | ||
var result = parse(args, conf); | ||
expect(result.raw).to.eql(args); | ||
expect(result.options.p) | ||
@@ -61,0 +67,0 @@ .to.be.a('string').that.equals('variable=value'); |
27629
0.74%607
1%