deployphp/node_modules/minimist/test/dotted.js

25 lines
586 B
JavaScript
Raw Normal View History

2023-03-28 15:15:22 +00:00
'use strict';
2023-01-10 15:49:41 +00:00
var parse = require('../');
var test = require('tape');
test('dotted alias', function (t) {
2023-03-28 15:15:22 +00:00
var argv = parse(['--a.b', '22'], { default: { 'a.b': 11 }, alias: { 'a.b': 'aa.bb' } });
t.equal(argv.a.b, 22);
t.equal(argv.aa.bb, 22);
t.end();
2023-01-10 15:49:41 +00:00
});
test('dotted default', function (t) {
2023-03-28 15:15:22 +00:00
var argv = parse('', { default: { 'a.b': 11 }, alias: { 'a.b': 'aa.bb' } });
t.equal(argv.a.b, 11);
t.equal(argv.aa.bb, 11);
t.end();
2023-01-10 15:49:41 +00:00
});
test('dotted default with no alias', function (t) {
2023-03-28 15:15:22 +00:00
var argv = parse('', { default: { 'a.b': 11 } });
t.equal(argv.a.b, 11);
t.end();
2023-01-10 15:49:41 +00:00
});