From aae6ea51a496301011c41a874a25b77596d5c560 Mon Sep 17 00:00:00 2001 From: Axetroy Date: Wed, 20 Mar 2019 01:24:11 +0800 Subject: move test file out of tests dir in flags module (denoland/deno_std#293) Original: https://github.com/denoland/deno_std/commit/e80f14489084d748bb52c4311519f5d0c7696f47 --- flags/all_bool_test.ts | 34 ++++++++ flags/bool_test.ts | 157 +++++++++++++++++++++++++++++++++++ flags/dash_test.ts | 29 +++++++ flags/default_bool_test.ts | 33 ++++++++ flags/dotted_test.ts | 24 ++++++ flags/kv_short_test.ts | 14 ++++ flags/long_test.ts | 20 +++++ flags/num_test.ts | 41 ++++++++++ flags/parse_test.ts | 194 ++++++++++++++++++++++++++++++++++++++++++++ flags/short_test.ts | 46 +++++++++++ flags/stop_early_test.ts | 16 ++++ flags/test.ts | 26 +++--- flags/tests/all_bool.ts | 34 -------- flags/tests/bool.ts | 157 ----------------------------------- flags/tests/dash.ts | 29 ------- flags/tests/default_bool.ts | 33 -------- flags/tests/dotted.ts | 24 ------ flags/tests/kv_short.ts | 14 ---- flags/tests/long.ts | 20 ----- flags/tests/num.ts | 41 ---------- flags/tests/parse.ts | 194 -------------------------------------------- flags/tests/short.ts | 46 ----------- flags/tests/stop_early.ts | 16 ---- flags/tests/unknown.ts | 98 ---------------------- flags/tests/whitespace.ts | 8 -- flags/unknown_test.ts | 98 ++++++++++++++++++++++ flags/whitespace_test.ts | 8 ++ 27 files changed, 727 insertions(+), 727 deletions(-) create mode 100755 flags/all_bool_test.ts create mode 100755 flags/bool_test.ts create mode 100755 flags/dash_test.ts create mode 100755 flags/default_bool_test.ts create mode 100755 flags/dotted_test.ts create mode 100755 flags/kv_short_test.ts create mode 100755 flags/long_test.ts create mode 100755 flags/num_test.ts create mode 100755 flags/parse_test.ts create mode 100755 flags/short_test.ts create mode 100755 flags/stop_early_test.ts delete mode 100755 flags/tests/all_bool.ts delete mode 100755 flags/tests/bool.ts delete mode 100755 flags/tests/dash.ts delete mode 100755 flags/tests/default_bool.ts delete mode 100755 flags/tests/dotted.ts delete mode 100755 flags/tests/kv_short.ts delete mode 100755 flags/tests/long.ts delete mode 100755 flags/tests/num.ts delete mode 100755 flags/tests/parse.ts delete mode 100755 flags/tests/short.ts delete mode 100755 flags/tests/stop_early.ts delete mode 100755 flags/tests/unknown.ts delete mode 100755 flags/tests/whitespace.ts create mode 100755 flags/unknown_test.ts create mode 100755 flags/whitespace_test.ts diff --git a/flags/all_bool_test.ts b/flags/all_bool_test.ts new file mode 100755 index 000000000..59779c779 --- /dev/null +++ b/flags/all_bool_test.ts @@ -0,0 +1,34 @@ +// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. +import { test } from "../testing/mod.ts"; +import { assertEquals } from "../testing/asserts.ts"; +import { parse } from "./mod.ts"; + +// flag boolean true (default all --args to boolean) +test(function flagBooleanTrue() { + const argv = parse(["moo", "--honk", "cow"], { + boolean: true + }); + + assertEquals(argv, { + honk: true, + _: ["moo", "cow"] + }); + + assertEquals(typeof argv.honk, "boolean"); +}); + +// flag boolean true only affects double hyphen arguments without equals signs +test(function flagBooleanTrueOnlyAffectsDoubleDash() { + var argv = parse(["moo", "--honk", "cow", "-p", "55", "--tacos=good"], { + boolean: true + }); + + assertEquals(argv, { + honk: true, + tacos: "good", + p: 55, + _: ["moo", "cow"] + }); + + assertEquals(typeof argv.honk, "boolean"); +}); diff --git a/flags/bool_test.ts b/flags/bool_test.ts new file mode 100755 index 000000000..820393543 --- /dev/null +++ b/flags/bool_test.ts @@ -0,0 +1,157 @@ +// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. +import { test } from "../testing/mod.ts"; +import { assertEquals } from "../testing/asserts.ts"; +import { parse } from "./mod.ts"; + +test(function flagBooleanDefaultFalse() { + const argv = parse(["moo"], { + boolean: ["t", "verbose"], + default: { verbose: false, t: false } + }); + + assertEquals(argv, { + verbose: false, + t: false, + _: ["moo"] + }); + + assertEquals(typeof argv.verbose, "boolean"); + assertEquals(typeof argv.t, "boolean"); +}); + +test(function booleanGroups() { + const argv = parse(["-x", "-z", "one", "two", "three"], { + boolean: ["x", "y", "z"] + }); + + assertEquals(argv, { + x: true, + y: false, + z: true, + _: ["one", "two", "three"] + }); + + assertEquals(typeof argv.x, "boolean"); + assertEquals(typeof argv.y, "boolean"); + assertEquals(typeof argv.z, "boolean"); +}); + +test(function booleanAndAliasWithChainableApi() { + const aliased = ["-h", "derp"]; + const regular = ["--herp", "derp"]; + const aliasedArgv = parse(aliased, { + boolean: "herp", + alias: { h: "herp" } + }); + const propertyArgv = parse(regular, { + boolean: "herp", + alias: { h: "herp" } + }); + const expected = { + herp: true, + h: true, + _: ["derp"] + }; + + assertEquals(aliasedArgv, expected); + assertEquals(propertyArgv, expected); +}); + +test(function booleanAndAliasWithOptionsHash() { + const aliased = ["-h", "derp"]; + const regular = ["--herp", "derp"]; + const opts = { + alias: { h: "herp" }, + boolean: "herp" + }; + const aliasedArgv = parse(aliased, opts); + const propertyArgv = parse(regular, opts); + const expected = { + herp: true, + h: true, + _: ["derp"] + }; + assertEquals(aliasedArgv, expected); + assertEquals(propertyArgv, expected); +}); + +test(function booleanAndAliasArrayWithOptionsHash() { + const aliased = ["-h", "derp"]; + const regular = ["--herp", "derp"]; + const alt = ["--harp", "derp"]; + const opts = { + alias: { h: ["herp", "harp"] }, + boolean: "h" + }; + const aliasedArgv = parse(aliased, opts); + const propertyArgv = parse(regular, opts); + const altPropertyArgv = parse(alt, opts); + const expected = { + harp: true, + herp: true, + h: true, + _: ["derp"] + }; + assertEquals(aliasedArgv, expected); + assertEquals(propertyArgv, expected); + assertEquals(altPropertyArgv, expected); +}); + +test(function booleanAndAliasUsingExplicitTrue() { + const aliased = ["-h", "true"]; + const regular = ["--herp", "true"]; + const opts = { + alias: { h: "herp" }, + boolean: "h" + }; + const aliasedArgv = parse(aliased, opts); + const propertyArgv = parse(regular, opts); + const expected = { + herp: true, + h: true, + _: [] + }; + + assertEquals(aliasedArgv, expected); + assertEquals(propertyArgv, expected); +}); + +// regression, see https://github.com/substack/node-optimist/issues/71 +// boolean and --x=true +test(function booleanAndNonBoolean() { + const parsed = parse(["--boool", "--other=true"], { + boolean: "boool" + }); + + assertEquals(parsed.boool, true); + assertEquals(parsed.other, "true"); + + const parsed2 = parse(["--boool", "--other=false"], { + boolean: "boool" + }); + + assertEquals(parsed2.boool, true); + assertEquals(parsed2.other, "false"); +}); + +test(function booleanParsingTrue() { + const parsed = parse(["--boool=true"], { + default: { + boool: false + }, + boolean: ["boool"] + }); + + assertEquals(parsed.boool, true); +}); + +test(function booleanParsingFalse() { + const parsed = parse(["--boool=false"], { + default: { + boool: true + }, + boolean: ["boool"] + }); + + assertEquals(parsed.boool, false); +}); diff --git a/flags/dash_test.ts b/flags/dash_test.ts new file mode 100755 index 000000000..7d52e4905 --- /dev/null +++ b/flags/dash_test.ts @@ -0,0 +1,29 @@ +// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. +import { test } from "../testing/mod.ts"; +import { assertEquals } from "../testing/asserts.ts"; +import { parse } from "./mod.ts"; + +test(function hyphen() { + assertEquals(parse(["-n", "-"]), { n: "-", _: [] }); + assertEquals(parse(["-"]), { _: ["-"] }); + assertEquals(parse(["-f-"]), { f: "-", _: [] }); + assertEquals(parse(["-b", "-"], { boolean: "b" }), { b: true, _: ["-"] }); + assertEquals(parse(["-s", "-"], { string: "s" }), { s: "-", _: [] }); +}); + +test(function doubleDash() { + assertEquals(parse(["-a", "--", "b"]), { a: true, _: ["b"] }); + assertEquals(parse(["--a", "--", "b"]), { a: true, _: ["b"] }); + assertEquals(parse(["--a", "--", "b"]), { a: true, _: ["b"] }); +}); + +test(function moveArgsAfterDoubleDashIntoOwnArray() { + assertEquals( + parse(["--name", "John", "before", "--", "after"], { "--": true }), + { + name: "John", + _: ["before"], + "--": ["after"] + } + ); +}); diff --git a/flags/default_bool_test.ts b/flags/default_bool_test.ts new file mode 100755 index 000000000..a1a329074 --- /dev/null +++ b/flags/default_bool_test.ts @@ -0,0 +1,33 @@ +// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. +import { test } from "../testing/mod.ts"; +import { assertEquals } from "../testing/asserts.ts"; +import { parse } from "./mod.ts"; + +test(function booleanDefaultTrue() { + const argv = parse([], { + boolean: "sometrue", + default: { sometrue: true } + }); + assertEquals(argv.sometrue, true); +}); + +test(function booleanDefaultFalse() { + const argv = parse([], { + boolean: "somefalse", + default: { somefalse: false } + }); + assertEquals(argv.somefalse, false); +}); + +test(function booleanDefaultNull() { + const argv = parse([], { + boolean: "maybe", + default: { maybe: null } + }); + assertEquals(argv.maybe, null); + const argv2 = parse(["--maybe"], { + boolean: "maybe", + default: { maybe: null } + }); + assertEquals(argv2.maybe, true); +}); diff --git a/flags/dotted_test.ts b/flags/dotted_test.ts new file mode 100755 index 000000000..d5a491815 --- /dev/null +++ b/flags/dotted_test.ts @@ -0,0 +1,24 @@ +// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. +import { test } from "../testing/mod.ts"; +import { assertEquals } from "../testing/asserts.ts"; +import { parse } from "./mod.ts"; + +test(function dottedAlias() { + const argv = parse(["--a.b", "22"], { + default: { "a.b": 11 }, + alias: { "a.b": "aa.bb" } + }); + assertEquals(argv.a.b, 22); + assertEquals(argv.aa.bb, 22); +}); + +test(function dottedDefault() { + const argv = parse("", { default: { "a.b": 11 }, alias: { "a.b": "aa.bb" } }); + assertEquals(argv.a.b, 11); + assertEquals(argv.aa.bb, 11); +}); + +test(function dottedDefaultWithNoAlias() { + const argv = parse("", { default: { "a.b": 11 } }); + assertEquals(argv.a.b, 11); +}); diff --git a/flags/kv_short_test.ts b/flags/kv_short_test.ts new file mode 100755 index 000000000..0cd93df02 --- /dev/null +++ b/flags/kv_short_test.ts @@ -0,0 +1,14 @@ +// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. +import { test } from "../testing/mod.ts"; +import { assertEquals } from "../testing/asserts.ts"; +import { parse } from "./mod.ts"; + +test(function short() { + const argv = parse(["-b=123"]); + assertEquals(argv, { b: 123, _: [] }); +}); + +test(function multiShort() { + const argv = parse(["-a=whatever", "-b=robots"]); + assertEquals(argv, { a: "whatever", b: "robots", _: [] }); +}); diff --git a/flags/long_test.ts b/flags/long_test.ts new file mode 100755 index 000000000..fb26a4c07 --- /dev/null +++ b/flags/long_test.ts @@ -0,0 +1,20 @@ +// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. +import { test } from "../testing/mod.ts"; +import { assertEquals } from "../testing/asserts.ts"; +import { parse } from "./mod.ts"; + +test(function longOpts() { + assertEquals(parse(["--bool"]), { bool: true, _: [] }); + assertEquals(parse(["--pow", "xixxle"]), { pow: "xixxle", _: [] }); + assertEquals(parse(["--pow=xixxle"]), { pow: "xixxle", _: [] }); + assertEquals(parse(["--host", "localhost", "--port", "555"]), { + host: "localhost", + port: 555, + _: [] + }); + assertEquals(parse(["--host=localhost", "--port=555"]), { + host: "localhost", + port: 555, + _: [] + }); +}); diff --git a/flags/num_test.ts b/flags/num_test.ts new file mode 100755 index 000000000..752e1752f --- /dev/null +++ b/flags/num_test.ts @@ -0,0 +1,41 @@ +// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. +import { test } from "../testing/mod.ts"; +import { assertEquals } from "../testing/asserts.ts"; +import { parse } from "./mod.ts"; + +test(function nums() { + const argv = parse([ + "-x", + "1234", + "-y", + "5.67", + "-z", + "1e7", + "-w", + "10f", + "--hex", + "0xdeadbeef", + "789" + ]); + assertEquals(argv, { + x: 1234, + y: 5.67, + z: 1e7, + w: "10f", + hex: 0xdeadbeef, + _: [789] + }); + assertEquals(typeof argv.x, "number"); + assertEquals(typeof argv.y, "number"); + assertEquals(typeof argv.z, "number"); + assertEquals(typeof argv.w, "string"); + assertEquals(typeof argv.hex, "number"); + assertEquals(typeof argv._[0], "number"); +}); + +test(function alreadyNumber() { + const argv = parse(["-x", 1234, 789]); + assertEquals(argv, { x: 1234, _: [789] }); + assertEquals(typeof argv.x, "number"); + assertEquals(typeof argv._[0], "number"); +}); diff --git a/flags/parse_test.ts b/flags/parse_test.ts new file mode 100755 index 000000000..dbcdb4a86 --- /dev/null +++ b/flags/parse_test.ts @@ -0,0 +1,194 @@ +// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. +import { test } from "../testing/mod.ts"; +import { assertEquals } from "../testing/asserts.ts"; +import { parse } from "./mod.ts"; + +test(function _arseArgs() { + assertEquals(parse(["--no-moo"]), { moo: false, _: [] }); + assertEquals(parse(["-v", "a", "-v", "b", "-v", "c"]), { + v: ["a", "b", "c"], + _: [] + }); +}); + +test(function comprehensive() { + assertEquals( + parse([ + "--name=meowmers", + "bare", + "-cats", + "woo", + "-h", + "awesome", + "--multi=quux", + "--key", + "value", + "-b", + "--bool", + "--no-meep", + "--multi=baz", + "--", + "--not-a-flag", + "eek" + ]), + { + c: true, + a: true, + t: true, + s: "woo", + h: "awesome", + b: true, + bool: true, + key: "value", + multi: ["quux", "baz"], + meep: false, + name: "meowmers", + _: ["bare", "--not-a-flag", "eek"] + } + ); +}); + +test(function flagBoolean() { + const argv = parse(["-t", "moo"], { boolean: "t" }); + assertEquals(argv, { t: true, _: ["moo"] }); + assertEquals(typeof argv.t, "boolean"); +}); + +test(function flagBooleanValue() { + const argv = parse(["--verbose", "false", "moo", "-t", "true"], { + boolean: ["t", "verbose"], + default: { verbose: true } + }); + + assertEquals(argv, { + verbose: false, + t: true, + _: ["moo"] + }); + + assertEquals(typeof argv.verbose, "boolean"); + assertEquals(typeof argv.t, "boolean"); +}); + +test(function newlinesInParams() { + const args = parse(["-s", "X\nX"]); + assertEquals(args, { _: [], s: "X\nX" }); + + // reproduce in bash: + // VALUE="new + // line" + // deno program.js --s="$VALUE" + const args2 = parse(["--s=X\nX"]); + assertEquals(args2, { _: [], s: "X\nX" }); +}); + +test(function strings() { + const s = parse(["-s", "0001234"], { string: "s" }).s; + assertEquals(s, "0001234"); + assertEquals(typeof s, "string"); + + const x = parse(["-x", "56"], { string: "x" }).x; + assertEquals(x, "56"); + assertEquals(typeof x, "string"); +}); + +test(function stringArgs() { + const s = parse([" ", " "], { string: "_" })._; + assertEquals(s.length, 2); + assertEquals(typeof s[0], "string"); + assertEquals(s[0], " "); + assertEquals(typeof s[1], "string"); + assertEquals(s[1], " "); +}); + +test(function emptyStrings() { + const s = parse(["-s"], { string: "s" }).s; + assertEquals(s, ""); + assertEquals(typeof s, "string"); + + const str = parse(["--str"], { string: "str" }).str; + assertEquals(str, ""); + assertEquals(typeof str, "string"); + + const letters = parse(["-art"], { + string: ["a", "t"] + }); + + assertEquals(letters.a, ""); + assertEquals(letters.r, true); + assertEquals(letters.t, ""); +}); + +test(function stringAndAlias() { + const x = parse(["--str", "000123"], { + string: "s", + alias: { s: "str" } + }); + + assertEquals(x.str, "000123"); + assertEquals(typeof x.str, "string"); + assertEquals(x.s, "000123"); + assertEquals(typeof x.s, "string"); + + const y = parse(["-s", "000123"], { + string: "str", + alias: { str: "s" } + }); + + assertEquals(y.str, "000123"); + assertEquals(typeof y.str, "string"); + assertEquals(y.s, "000123"); + assertEquals(typeof y.s, "string"); +}); + +test(function slashBreak() { + assertEquals(parse(["-I/foo/bar/baz"]), { I: "/foo/bar/baz", _: [] }); + assertEquals(parse(["-xyz/foo/bar/baz"]), { + x: true, + y: true, + z: "/foo/bar/baz", + _: [] + }); +}); + +test(function alias() { + const argv = parse(["-f", "11", "--zoom", "55"], { + alias: { z: "zoom" } + }); + assertEquals(argv.zoom, 55); + assertEquals(argv.z, argv.zoom); + assertEquals(argv.f, 11); +}); + +test(function multiAlias() { + const argv = parse(["-f", "11", "--zoom", "55"], { + alias: { z: ["zm", "zoom"] } + }); + assertEquals(argv.zoom, 55); + assertEquals(argv.z, argv.zoom); + assertEquals(argv.z, argv.zm); + assertEquals(argv.f, 11); +}); + +test(function nestedDottedObjects() { + const argv = parse([ + "--foo.bar", + "3", + "--foo.baz", + "4", + "--foo.quux.quibble", + "5", + "--foo.quux.oO", + "--beep.boop" + ]); + + assertEquals(argv.foo, { + bar: 3, + baz: 4, + quux: { + quibble: 5, + oO: true + } + }); + assertEquals(argv.beep, { boop: true }); +}); diff --git a/flags/short_test.ts b/flags/short_test.ts new file mode 100755 index 000000000..700902dd7 --- /dev/null +++ b/flags/short_test.ts @@ -0,0 +1,46 @@ +// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. +import { test } from "../testing/mod.ts"; +import { assertEquals } from "../testing/asserts.ts"; +import { parse } from "./mod.ts"; + +test(function numbericShortArgs() { + assertEquals(parse(["-n123"]), { n: 123, _: [] }); + assertEquals(parse(["-123", "456"]), { 1: true, 2: true, 3: 456, _: [] }); +}); + +test(function short() { + assertEquals(parse(["-b"]), { b: true, _: [] }); + assertEquals(parse(["foo", "bar", "baz"]), { _: ["foo", "bar", "baz"] }); + assertEquals(parse(["-cats"]), { c: true, a: true, t: true, s: true, _: [] }); + assertEquals(parse(["-cats", "meow"]), { + c: true, + a: true, + t: true, + s: "meow", + _: [] + }); + assertEquals(parse(["-h", "localhost"]), { h: "localhost", _: [] }); + assertEquals(parse(["-h", "localhost", "-p", "555"]), { + h: "localhost", + p: 555, + _: [] + }); +}); + +test(function mixedShortBoolAndCapture() { + assertEquals(parse(["-h", "localhost", "-fp", "555", "script.js"]), { + f: true, + p: 555, + h: "localhost", + _: ["script.js"] + }); +}); + +test(function shortAndLong() { + assertEquals(parse(["-h", "localhost", "-fp", "555", "script.js"]), { + f: true, + p: 555, + h: "localhost", + _: ["script.js"] + }); +}); diff --git a/flags/stop_early_test.ts b/flags/stop_early_test.ts new file mode 100755 index 000000000..70194adfe --- /dev/null +++ b/flags/stop_early_test.ts @@ -0,0 +1,16 @@ +// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. +import { test } from "../testing/mod.ts"; +import { assertEquals } from "../testing/asserts.ts"; +import { parse } from "./mod.ts"; + +// stops parsing on the first non-option when stopEarly is set +test(function stopParsing() { + const argv = parse(["--aaa", "bbb", "ccc", "--ddd"], { + stopEarly: true + }); + + assertEquals(argv, { + aaa: "bbb", + _: ["ccc", "--ddd"] + }); +}); diff --git a/flags/test.ts b/flags/test.ts index 66aa8d2cd..f8e928555 100644 --- a/flags/test.ts +++ b/flags/test.ts @@ -1,14 +1,14 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import "./tests/all_bool.ts"; -import "./tests/bool.ts"; -import "./tests/dash.ts"; -import "./tests/default_bool.ts"; -import "./tests/dotted.ts"; -import "./tests/kv_short.ts"; -import "./tests/long.ts"; -import "./tests/num.ts"; -import "./tests/parse.ts"; -import "./tests/short.ts"; -import "./tests/stop_early.ts"; -import "./tests/unknown.ts"; -import "./tests/whitespace.ts"; +import "./all_bool_test.ts"; +import "./bool_test.ts"; +import "./dash_test.ts"; +import "./default_bool_test.ts"; +import "./dotted_test.ts"; +import "./kv_short_test.ts"; +import "./long_test.ts"; +import "./num_test.ts"; +import "./parse_test.ts"; +import "./short_test.ts"; +import "./stop_early_test.ts"; +import "./unknown_test.ts"; +import "./whitespace_test.ts"; diff --git a/flags/tests/all_bool.ts b/flags/tests/all_bool.ts deleted file mode 100755 index e88919378..000000000 --- a/flags/tests/all_bool.ts +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import { test } from "../../testing/mod.ts"; -import { assertEquals } from "../../testing/asserts.ts"; -import { parse } from "../mod.ts"; - -// flag boolean true (default all --args to boolean) -test(function flagBooleanTrue() { - const argv = parse(["moo", "--honk", "cow"], { - boolean: true - }); - - assertEquals(argv, { - honk: true, - _: ["moo", "cow"] - }); - - assertEquals(typeof argv.honk, "boolean"); -}); - -// flag boolean true only affects double hyphen arguments without equals signs -test(function flagBooleanTrueOnlyAffectsDoubleDash() { - var argv = parse(["moo", "--honk", "cow", "-p", "55", "--tacos=good"], { - boolean: true - }); - - assertEquals(argv, { - honk: true, - tacos: "good", - p: 55, - _: ["moo", "cow"] - }); - - assertEquals(typeof argv.honk, "boolean"); -}); diff --git a/flags/tests/bool.ts b/flags/tests/bool.ts deleted file mode 100755 index bffb1fd34..000000000 --- a/flags/tests/bool.ts +++ /dev/null @@ -1,157 +0,0 @@ -// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import { test } from "../../testing/mod.ts"; -import { assertEquals } from "../../testing/asserts.ts"; -import { parse } from "../mod.ts"; - -test(function flagBooleanDefaultFalse() { - const argv = parse(["moo"], { - boolean: ["t", "verbose"], - default: { verbose: false, t: false } - }); - - assertEquals(argv, { - verbose: false, - t: false, - _: ["moo"] - }); - - assertEquals(typeof argv.verbose, "boolean"); - assertEquals(typeof argv.t, "boolean"); -}); - -test(function booleanGroups() { - const argv = parse(["-x", "-z", "one", "two", "three"], { - boolean: ["x", "y", "z"] - }); - - assertEquals(argv, { - x: true, - y: false, - z: true, - _: ["one", "two", "three"] - }); - - assertEquals(typeof argv.x, "boolean"); - assertEquals(typeof argv.y, "boolean"); - assertEquals(typeof argv.z, "boolean"); -}); - -test(function booleanAndAliasWithChainableApi() { - const aliased = ["-h", "derp"]; - const regular = ["--herp", "derp"]; - const aliasedArgv = parse(aliased, { - boolean: "herp", - alias: { h: "herp" } - }); - const propertyArgv = parse(regular, { - boolean: "herp", - alias: { h: "herp" } - }); - const expected = { - herp: true, - h: true, - _: ["derp"] - }; - - assertEquals(aliasedArgv, expected); - assertEquals(propertyArgv, expected); -}); - -test(function booleanAndAliasWithOptionsHash() { - const aliased = ["-h", "derp"]; - const regular = ["--herp", "derp"]; - const opts = { - alias: { h: "herp" }, - boolean: "herp" - }; - const aliasedArgv = parse(aliased, opts); - const propertyArgv = parse(regular, opts); - const expected = { - herp: true, - h: true, - _: ["derp"] - }; - assertEquals(aliasedArgv, expected); - assertEquals(propertyArgv, expected); -}); - -test(function booleanAndAliasArrayWithOptionsHash() { - const aliased = ["-h", "derp"]; - const regular = ["--herp", "derp"]; - const alt = ["--harp", "derp"]; - const opts = { - alias: { h: ["herp", "harp"] }, - boolean: "h" - }; - const aliasedArgv = parse(aliased, opts); - const propertyArgv = parse(regular, opts); - const altPropertyArgv = parse(alt, opts); - const expected = { - harp: true, - herp: true, - h: true, - _: ["derp"] - }; - assertEquals(aliasedArgv, expected); - assertEquals(propertyArgv, expected); - assertEquals(altPropertyArgv, expected); -}); - -test(function booleanAndAliasUsingExplicitTrue() { - const aliased = ["-h", "true"]; - const regular = ["--herp", "true"]; - const opts = { - alias: { h: "herp" }, - boolean: "h" - }; - const aliasedArgv = parse(aliased, opts); - const propertyArgv = parse(regular, opts); - const expected = { - herp: true, - h: true, - _: [] - }; - - assertEquals(aliasedArgv, expected); - assertEquals(propertyArgv, expected); -}); - -// regression, see https://github.com/substack/node-optimist/issues/71 -// boolean and --x=true -test(function booleanAndNonBoolean() { - const parsed = parse(["--boool", "--other=true"], { - boolean: "boool" - }); - - assertEquals(parsed.boool, true); - assertEquals(parsed.other, "true"); - - const parsed2 = parse(["--boool", "--other=false"], { - boolean: "boool" - }); - - assertEquals(parsed2.boool, true); - assertEquals(parsed2.other, "false"); -}); - -test(function booleanParsingTrue() { - const parsed = parse(["--boool=true"], { - default: { - boool: false - }, - boolean: ["boool"] - }); - - assertEquals(parsed.boool, true); -}); - -test(function booleanParsingFalse() { - const parsed = parse(["--boool=false"], { - default: { - boool: true - }, - boolean: ["boool"] - }); - - assertEquals(parsed.boool, false); -}); diff --git a/flags/tests/dash.ts b/flags/tests/dash.ts deleted file mode 100755 index f70108124..000000000 --- a/flags/tests/dash.ts +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import { test } from "../../testing/mod.ts"; -import { assertEquals } from "../../testing/asserts.ts"; -import { parse } from "../mod.ts"; - -test(function hyphen() { - assertEquals(parse(["-n", "-"]), { n: "-", _: [] }); - assertEquals(parse(["-"]), { _: ["-"] }); - assertEquals(parse(["-f-"]), { f: "-", _: [] }); - assertEquals(parse(["-b", "-"], { boolean: "b" }), { b: true, _: ["-"] }); - assertEquals(parse(["-s", "-"], { string: "s" }), { s: "-", _: [] }); -}); - -test(function doubleDash() { - assertEquals(parse(["-a", "--", "b"]), { a: true, _: ["b"] }); - assertEquals(parse(["--a", "--", "b"]), { a: true, _: ["b"] }); - assertEquals(parse(["--a", "--", "b"]), { a: true, _: ["b"] }); -}); - -test(function moveArgsAfterDoubleDashIntoOwnArray() { - assertEquals( - parse(["--name", "John", "before", "--", "after"], { "--": true }), - { - name: "John", - _: ["before"], - "--": ["after"] - } - ); -}); diff --git a/flags/tests/default_bool.ts b/flags/tests/default_bool.ts deleted file mode 100755 index 43e91c8c0..000000000 --- a/flags/tests/default_bool.ts +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import { test } from "../../testing/mod.ts"; -import { assertEquals } from "../../testing/asserts.ts"; -import { parse } from "../mod.ts"; - -test(function booleanDefaultTrue() { - const argv = parse([], { - boolean: "sometrue", - default: { sometrue: true } - }); - assertEquals(argv.sometrue, true); -}); - -test(function booleanDefaultFalse() { - const argv = parse([], { - boolean: "somefalse", - default: { somefalse: false } - }); - assertEquals(argv.somefalse, false); -}); - -test(function booleanDefaultNull() { - const argv = parse([], { - boolean: "maybe", - default: { maybe: null } - }); - assertEquals(argv.maybe, null); - const argv2 = parse(["--maybe"], { - boolean: "maybe", - default: { maybe: null } - }); - assertEquals(argv2.maybe, true); -}); diff --git a/flags/tests/dotted.ts b/flags/tests/dotted.ts deleted file mode 100755 index c2179a3a8..000000000 --- a/flags/tests/dotted.ts +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import { test } from "../../testing/mod.ts"; -import { assertEquals } from "../../testing/asserts.ts"; -import { parse } from "../mod.ts"; - -test(function dottedAlias() { - const argv = parse(["--a.b", "22"], { - default: { "a.b": 11 }, - alias: { "a.b": "aa.bb" } - }); - assertEquals(argv.a.b, 22); - assertEquals(argv.aa.bb, 22); -}); - -test(function dottedDefault() { - const argv = parse("", { default: { "a.b": 11 }, alias: { "a.b": "aa.bb" } }); - assertEquals(argv.a.b, 11); - assertEquals(argv.aa.bb, 11); -}); - -test(function dottedDefaultWithNoAlias() { - const argv = parse("", { default: { "a.b": 11 } }); - assertEquals(argv.a.b, 11); -}); diff --git a/flags/tests/kv_short.ts b/flags/tests/kv_short.ts deleted file mode 100755 index b5a216b75..000000000 --- a/flags/tests/kv_short.ts +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import { test } from "../../testing/mod.ts"; -import { assertEquals } from "../../testing/asserts.ts"; -import { parse } from "../mod.ts"; - -test(function short() { - const argv = parse(["-b=123"]); - assertEquals(argv, { b: 123, _: [] }); -}); - -test(function multiShort() { - const argv = parse(["-a=whatever", "-b=robots"]); - assertEquals(argv, { a: "whatever", b: "robots", _: [] }); -}); diff --git a/flags/tests/long.ts b/flags/tests/long.ts deleted file mode 100755 index 04f563d42..000000000 --- a/flags/tests/long.ts +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import { test } from "../../testing/mod.ts"; -import { assertEquals } from "../../testing/asserts.ts"; -import { parse } from "../mod.ts"; - -test(function longOpts() { - assertEquals(parse(["--bool"]), { bool: true, _: [] }); - assertEquals(parse(["--pow", "xixxle"]), { pow: "xixxle", _: [] }); - assertEquals(parse(["--pow=xixxle"]), { pow: "xixxle", _: [] }); - assertEquals(parse(["--host", "localhost", "--port", "555"]), { - host: "localhost", - port: 555, - _: [] - }); - assertEquals(parse(["--host=localhost", "--port=555"]), { - host: "localhost", - port: 555, - _: [] - }); -}); diff --git a/flags/tests/num.ts b/flags/tests/num.ts deleted file mode 100755 index b140ea18a..000000000 --- a/flags/tests/num.ts +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import { test } from "../../testing/mod.ts"; -import { assertEquals } from "../../testing/asserts.ts"; -import { parse } from "../mod.ts"; - -test(function nums() { - const argv = parse([ - "-x", - "1234", - "-y", - "5.67", - "-z", - "1e7", - "-w", - "10f", - "--hex", - "0xdeadbeef", - "789" - ]); - assertEquals(argv, { - x: 1234, - y: 5.67, - z: 1e7, - w: "10f", - hex: 0xdeadbeef, - _: [789] - }); - assertEquals(typeof argv.x, "number"); - assertEquals(typeof argv.y, "number"); - assertEquals(typeof argv.z, "number"); - assertEquals(typeof argv.w, "string"); - assertEquals(typeof argv.hex, "number"); - assertEquals(typeof argv._[0], "number"); -}); - -test(function alreadyNumber() { - const argv = parse(["-x", 1234, 789]); - assertEquals(argv, { x: 1234, _: [789] }); - assertEquals(typeof argv.x, "number"); - assertEquals(typeof argv._[0], "number"); -}); diff --git a/flags/tests/parse.ts b/flags/tests/parse.ts deleted file mode 100755 index a37cd4c63..000000000 --- a/flags/tests/parse.ts +++ /dev/null @@ -1,194 +0,0 @@ -// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import { test } from "../../testing/mod.ts"; -import { assertEquals } from "../../testing/asserts.ts"; -import { parse } from "../mod.ts"; - -test(function _arseArgs() { - assertEquals(parse(["--no-moo"]), { moo: false, _: [] }); - assertEquals(parse(["-v", "a", "-v", "b", "-v", "c"]), { - v: ["a", "b", "c"], - _: [] - }); -}); - -test(function comprehensive() { - assertEquals( - parse([ - "--name=meowmers", - "bare", - "-cats", - "woo", - "-h", - "awesome", - "--multi=quux", - "--key", - "value", - "-b", - "--bool", - "--no-meep", - "--multi=baz", - "--", - "--not-a-flag", - "eek" - ]), - { - c: true, - a: true, - t: true, - s: "woo", - h: "awesome", - b: true, - bool: true, - key: "value", - multi: ["quux", "baz"], - meep: false, - name: "meowmers", - _: ["bare", "--not-a-flag", "eek"] - } - ); -}); - -test(function flagBoolean() { - const argv = parse(["-t", "moo"], { boolean: "t" }); - assertEquals(argv, { t: true, _: ["moo"] }); - assertEquals(typeof argv.t, "boolean"); -}); - -test(function flagBooleanValue() { - const argv = parse(["--verbose", "false", "moo", "-t", "true"], { - boolean: ["t", "verbose"], - default: { verbose: true } - }); - - assertEquals(argv, { - verbose: false, - t: true, - _: ["moo"] - }); - - assertEquals(typeof argv.verbose, "boolean"); - assertEquals(typeof argv.t, "boolean"); -}); - -test(function newlinesInParams() { - const args = parse(["-s", "X\nX"]); - assertEquals(args, { _: [], s: "X\nX" }); - - // reproduce in bash: - // VALUE="new - // line" - // deno program.js --s="$VALUE" - const args2 = parse(["--s=X\nX"]); - assertEquals(args2, { _: [], s: "X\nX" }); -}); - -test(function strings() { - const s = parse(["-s", "0001234"], { string: "s" }).s; - assertEquals(s, "0001234"); - assertEquals(typeof s, "string"); - - const x = parse(["-x", "56"], { string: "x" }).x; - assertEquals(x, "56"); - assertEquals(typeof x, "string"); -}); - -test(function stringArgs() { - const s = parse([" ", " "], { string: "_" })._; - assertEquals(s.length, 2); - assertEquals(typeof s[0], "string"); - assertEquals(s[0], " "); - assertEquals(typeof s[1], "string"); - assertEquals(s[1], " "); -}); - -test(function emptyStrings() { - const s = parse(["-s"], { string: "s" }).s; - assertEquals(s, ""); - assertEquals(typeof s, "string"); - - const str = parse(["--str"], { string: "str" }).str; - assertEquals(str, ""); - assertEquals(typeof str, "string"); - - const letters = parse(["-art"], { - string: ["a", "t"] - }); - - assertEquals(letters.a, ""); - assertEquals(letters.r, true); - assertEquals(letters.t, ""); -}); - -test(function stringAndAlias() { - const x = parse(["--str", "000123"], { - string: "s", - alias: { s: "str" } - }); - - assertEquals(x.str, "000123"); - assertEquals(typeof x.str, "string"); - assertEquals(x.s, "000123"); - assertEquals(typeof x.s, "string"); - - const y = parse(["-s", "000123"], { - string: "str", - alias: { str: "s" } - }); - - assertEquals(y.str, "000123"); - assertEquals(typeof y.str, "string"); - assertEquals(y.s, "000123"); - assertEquals(typeof y.s, "string"); -}); - -test(function slashBreak() { - assertEquals(parse(["-I/foo/bar/baz"]), { I: "/foo/bar/baz", _: [] }); - assertEquals(parse(["-xyz/foo/bar/baz"]), { - x: true, - y: true, - z: "/foo/bar/baz", - _: [] - }); -}); - -test(function alias() { - const argv = parse(["-f", "11", "--zoom", "55"], { - alias: { z: "zoom" } - }); - assertEquals(argv.zoom, 55); - assertEquals(argv.z, argv.zoom); - assertEquals(argv.f, 11); -}); - -test(function multiAlias() { - const argv = parse(["-f", "11", "--zoom", "55"], { - alias: { z: ["zm", "zoom"] } - }); - assertEquals(argv.zoom, 55); - assertEquals(argv.z, argv.zoom); - assertEquals(argv.z, argv.zm); - assertEquals(argv.f, 11); -}); - -test(function nestedDottedObjects() { - const argv = parse([ - "--foo.bar", - "3", - "--foo.baz", - "4", - "--foo.quux.quibble", - "5", - "--foo.quux.oO", - "--beep.boop" - ]); - - assertEquals(argv.foo, { - bar: 3, - baz: 4, - quux: { - quibble: 5, - oO: true - } - }); - assertEquals(argv.beep, { boop: true }); -}); diff --git a/flags/tests/short.ts b/flags/tests/short.ts deleted file mode 100755 index 8c0d06d3a..000000000 --- a/flags/tests/short.ts +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import { test } from "../../testing/mod.ts"; -import { assertEquals } from "../../testing/asserts.ts"; -import { parse } from "../mod.ts"; - -test(function numbericShortArgs() { - assertEquals(parse(["-n123"]), { n: 123, _: [] }); - assertEquals(parse(["-123", "456"]), { 1: true, 2: true, 3: 456, _: [] }); -}); - -test(function short() { - assertEquals(parse(["-b"]), { b: true, _: [] }); - assertEquals(parse(["foo", "bar", "baz"]), { _: ["foo", "bar", "baz"] }); - assertEquals(parse(["-cats"]), { c: true, a: true, t: true, s: true, _: [] }); - assertEquals(parse(["-cats", "meow"]), { - c: true, - a: true, - t: true, - s: "meow", - _: [] - }); - assertEquals(parse(["-h", "localhost"]), { h: "localhost", _: [] }); - assertEquals(parse(["-h", "localhost", "-p", "555"]), { - h: "localhost", - p: 555, - _: [] - }); -}); - -test(function mixedShortBoolAndCapture() { - assertEquals(parse(["-h", "localhost", "-fp", "555", "script.js"]), { - f: true, - p: 555, - h: "localhost", - _: ["script.js"] - }); -}); - -test(function shortAndLong() { - assertEquals(parse(["-h", "localhost", "-fp", "555", "script.js"]), { - f: true, - p: 555, - h: "localhost", - _: ["script.js"] - }); -}); diff --git a/flags/tests/stop_early.ts b/flags/tests/stop_early.ts deleted file mode 100755 index 799b16b78..000000000 --- a/flags/tests/stop_early.ts +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import { test } from "../../testing/mod.ts"; -import { assertEquals } from "../../testing/asserts.ts"; -import { parse } from "../mod.ts"; - -// stops parsing on the first non-option when stopEarly is set -test(function stopParsing() { - const argv = parse(["--aaa", "bbb", "ccc", "--ddd"], { - stopEarly: true - }); - - assertEquals(argv, { - aaa: "bbb", - _: ["ccc", "--ddd"] - }); -}); diff --git a/flags/tests/unknown.ts b/flags/tests/unknown.ts deleted file mode 100755 index cd944746f..000000000 --- a/flags/tests/unknown.ts +++ /dev/null @@ -1,98 +0,0 @@ -// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import { test } from "../../testing/mod.ts"; -import { assertEquals } from "../../testing/asserts.ts"; -import { parse } from "../mod.ts"; - -test(function booleanAndAliasIsNotUnknown() { - const unknown = []; - function unknownFn(arg): boolean { - unknown.push(arg); - return false; - } - const aliased = ["-h", "true", "--derp", "true"]; - const regular = ["--herp", "true", "-d", "true"]; - const opts = { - alias: { h: "herp" }, - boolean: "h", - unknown: unknownFn - }; - parse(aliased, opts); - parse(regular, opts); - - assertEquals(unknown, ["--derp", "-d"]); -}); - -test(function flagBooleanTrueAnyDoubleHyphenArgumentIsNotUnknown() { - const unknown = []; - function unknownFn(arg): boolean { - unknown.push(arg); - return false; - } - const argv = parse(["--honk", "--tacos=good", "cow", "-p", "55"], { - boolean: true, - unknown: unknownFn - }); - assertEquals(unknown, ["--tacos=good", "cow", "-p"]); - assertEquals(argv, { - honk: true, - _: [] - }); -}); - -test(function stringAndAliasIsNotUnkown() { - const unknown = []; - function unknownFn(arg): boolean { - unknown.push(arg); - return false; - } - const aliased = ["-h", "hello", "--derp", "goodbye"]; - const regular = ["--herp", "hello", "-d", "moon"]; - const opts = { - alias: { h: "herp" }, - string: "h", - unknown: unknownFn - }; - parse(aliased, opts); - parse(regular, opts); - - assertEquals(unknown, ["--derp", "-d"]); -}); - -test(function defaultAndAliasIsNotUnknown() { - const unknown = []; - function unknownFn(arg): boolean { - unknown.push(arg); - return false; - } - const aliased = ["-h", "hello"]; - const regular = ["--herp", "hello"]; - const opts = { - default: { h: "bar" }, - alias: { h: "herp" }, - unknown: unknownFn - }; - parse(aliased, opts); - parse(regular, opts); - - assertEquals(unknown, []); -}); - -test(function valueFollowingDoubleHyphenIsNotUnknown() { - const unknown = []; - function unknownFn(arg): boolean { - unknown.push(arg); - return false; - } - const aliased = ["--bad", "--", "good", "arg"]; - const opts = { - "--": true, - unknown: unknownFn - }; - const argv = parse(aliased, opts); - - assertEquals(unknown, ["--bad"]); - assertEquals(argv, { - "--": ["good", "arg"], - _: [] - }); -}); diff --git a/flags/tests/whitespace.ts b/flags/tests/whitespace.ts deleted file mode 100755 index 54ff067c7..000000000 --- a/flags/tests/whitespace.ts +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import { test } from "../../testing/mod.ts"; -import { assertEquals } from "../../testing/asserts.ts"; -import { parse } from "../mod.ts"; - -test(function whitespaceShouldBeWhitespace() { - assertEquals(parse(["-x", "\t"]).x, "\t"); -}); diff --git a/flags/unknown_test.ts b/flags/unknown_test.ts new file mode 100755 index 000000000..fcb47e36b --- /dev/null +++ b/flags/unknown_test.ts @@ -0,0 +1,98 @@ +// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. +import { test } from "../testing/mod.ts"; +import { assertEquals } from "../testing/asserts.ts"; +import { parse } from "./mod.ts"; + +test(function booleanAndAliasIsNotUnknown() { + const unknown = []; + function unknownFn(arg): boolean { + unknown.push(arg); + return false; + } + const aliased = ["-h", "true", "--derp", "true"]; + const regular = ["--herp", "true", "-d", "true"]; + const opts = { + alias: { h: "herp" }, + boolean: "h", + unknown: unknownFn + }; + parse(aliased, opts); + parse(regular, opts); + + assertEquals(unknown, ["--derp", "-d"]); +}); + +test(function flagBooleanTrueAnyDoubleHyphenArgumentIsNotUnknown() { + const unknown = []; + function unknownFn(arg): boolean { + unknown.push(arg); + return false; + } + const argv = parse(["--honk", "--tacos=good", "cow", "-p", "55"], { + boolean: true, + unknown: unknownFn + }); + assertEquals(unknown, ["--tacos=good", "cow", "-p"]); + assertEquals(argv, { + honk: true, + _: [] + }); +}); + +test(function stringAndAliasIsNotUnkown() { + const unknown = []; + function unknownFn(arg): boolean { + unknown.push(arg); + return false; + } + const aliased = ["-h", "hello", "--derp", "goodbye"]; + const regular = ["--herp", "hello", "-d", "moon"]; + const opts = { + alias: { h: "herp" }, + string: "h", + unknown: unknownFn + }; + parse(aliased, opts); + parse(regular, opts); + + assertEquals(unknown, ["--derp", "-d"]); +}); + +test(function defaultAndAliasIsNotUnknown() { + const unknown = []; + function unknownFn(arg): boolean { + unknown.push(arg); + return false; + } + const aliased = ["-h", "hello"]; + const regular = ["--herp", "hello"]; + const opts = { + default: { h: "bar" }, + alias: { h: "herp" }, + unknown: unknownFn + }; + parse(aliased, opts); + parse(regular, opts); + + assertEquals(unknown, []); +}); + +test(function valueFollowingDoubleHyphenIsNotUnknown() { + const unknown = []; + function unknownFn(arg): boolean { + unknown.push(arg); + return false; + } + const aliased = ["--bad", "--", "good", "arg"]; + const opts = { + "--": true, + unknown: unknownFn + }; + const argv = parse(aliased, opts); + + assertEquals(unknown, ["--bad"]); + assertEquals(argv, { + "--": ["good", "arg"], + _: [] + }); +}); diff --git a/flags/whitespace_test.ts b/flags/whitespace_test.ts new file mode 100755 index 000000000..f0f24703c --- /dev/null +++ b/flags/whitespace_test.ts @@ -0,0 +1,8 @@ +// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. +import { test } from "../testing/mod.ts"; +import { assertEquals } from "../testing/asserts.ts"; +import { parse } from "./mod.ts"; + +test(function whitespaceShouldBeWhitespace() { + assertEquals(parse(["-x", "\t"]).x, "\t"); +}); -- cgit v1.2.3