initial
This commit is contained in:
38
node_modules/command-line-args/test/alias.js
generated
vendored
Normal file
38
node_modules/command-line-args/test/alias.js
generated
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
'use strict'
|
||||
const TestRunner = require('test-runner')
|
||||
const commandLineArgs = require('../')
|
||||
const a = require('assert')
|
||||
|
||||
const runner = new TestRunner()
|
||||
|
||||
runner.test('alias: one string alias', function () {
|
||||
const optionDefinitions = [
|
||||
{ name: 'verbose', alias: 'v' }
|
||||
]
|
||||
const argv = [ '-v' ]
|
||||
a.deepStrictEqual(commandLineArgs(optionDefinitions, { argv }), {
|
||||
verbose: null
|
||||
})
|
||||
})
|
||||
|
||||
runner.test('alias: one boolean alias', function () {
|
||||
const optionDefinitions = [
|
||||
{ name: 'dry-run', alias: 'd', type: Boolean }
|
||||
]
|
||||
const argv = [ '-d' ]
|
||||
a.deepStrictEqual(commandLineArgs(optionDefinitions, { argv }), {
|
||||
'dry-run': true
|
||||
})
|
||||
})
|
||||
|
||||
runner.test('alias: one boolean, one string', function () {
|
||||
const optionDefinitions = [
|
||||
{ name: 'verbose', alias: 'v', type: Boolean },
|
||||
{ name: 'colour', alias: 'c' }
|
||||
]
|
||||
const argv = [ '-v', '-c' ]
|
||||
a.deepStrictEqual(commandLineArgs(optionDefinitions, { argv }), {
|
||||
verbose: true,
|
||||
colour: null
|
||||
})
|
||||
})
|
Reference in New Issue
Block a user