2023-09-06 01:51:55 +00:00
|
|
|
'use strict';
|
|
|
|
|
2023-07-24 03:13:08 +00:00
|
|
|
var parse = require('../');
|
|
|
|
var test = require('tape');
|
|
|
|
|
|
|
|
test('dotted alias', function (t) {
|
2023-09-06 01:51:55 +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-07-24 03:13:08 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
test('dotted default', function (t) {
|
2023-09-06 01:51:55 +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-07-24 03:13:08 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
test('dotted default with no alias', function (t) {
|
2023-09-06 01:51:55 +00:00
|
|
|
var argv = parse('', { default: { 'a.b': 11 } });
|
|
|
|
t.equal(argv.a.b, 11);
|
|
|
|
t.end();
|
2023-07-24 03:13:08 +00:00
|
|
|
});
|