management/front/dkha-web-sz-main/node_modules/minimist/test/dotted.js

25 lines
586 B
JavaScript
Raw Normal View History

2023-12-28 23:41:32 +08:00
'use strict';
2023-12-18 13:12:25 +08:00
var parse = require('../');
var test = require('tape');
test('dotted alias', function (t) {
2023-12-28 23:41:32 +08: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-12-18 13:12:25 +08:00
});
test('dotted default', function (t) {
2023-12-28 23:41:32 +08: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-12-18 13:12:25 +08:00
});
test('dotted default with no alias', function (t) {
2023-12-28 23:41:32 +08:00
var argv = parse('', { default: { 'a.b': 11 } });
t.equal(argv.a.b, 11);
t.end();
2023-12-18 13:12:25 +08:00
});