ccc-tnt-psd2ui/npm-packages/mac-v2.4.x/minimist/test/dotted.js

23 lines
588 B
JavaScript
Raw Normal View History

2023-07-24 03:13:08 +00:00
var parse = require('../');
var test = require('tape');
test('dotted alias', function (t) {
2023-07-27 07:04:13 +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-07-27 07:04:13 +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-07-27 07:04:13 +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
});