2018-12-19 13:06:31 -05:00
|
|
|
import { test, assertEqual } from "https://deno.land/x/testing/testing.ts";
|
2018-12-21 13:02:52 -05:00
|
|
|
import { parse } from "../index.ts";
|
2018-12-19 13:06:31 -05:00
|
|
|
|
|
|
|
test(function dottedAlias() {
|
2018-12-21 13:02:52 -05:00
|
|
|
const argv = parse(['--a.b', '22'], {default: {'a.b': 11}, alias: {'a.b': 'aa.bb'}});
|
2018-12-19 13:06:31 -05:00
|
|
|
assertEqual(argv.a.b, 22);
|
|
|
|
assertEqual(argv.aa.bb, 22);
|
|
|
|
});
|
|
|
|
|
|
|
|
test(function dottedDefault() {
|
2018-12-21 13:02:52 -05:00
|
|
|
const argv = parse('', {default: {'a.b': 11}, alias: {'a.b': 'aa.bb'}});
|
2018-12-19 13:06:31 -05:00
|
|
|
assertEqual(argv.a.b, 11);
|
|
|
|
assertEqual(argv.aa.bb, 11);
|
|
|
|
});
|
|
|
|
|
|
|
|
test(function dottedDefaultWithNoAlias() {
|
2018-12-21 13:02:52 -05:00
|
|
|
const argv = parse('', {default: {'a.b': 11}});
|
2018-12-19 13:06:31 -05:00
|
|
|
assertEqual(argv.a.b, 11);
|
|
|
|
});
|