summaryrefslogtreecommitdiff
path: root/flags
diff options
context:
space:
mode:
Diffstat (limited to 'flags')
-rwxr-xr-xflags/tests/all_bool.ts11
-rwxr-xr-xflags/tests/bool.ts47
-rwxr-xr-xflags/tests/dash.ts28
-rwxr-xr-xflags/tests/default_bool.ts11
-rwxr-xr-xflags/tests/dotted.ts13
-rwxr-xr-xflags/tests/kv_short.ts7
-rwxr-xr-xflags/tests/long.ts13
-rwxr-xr-xflags/tests/num.ts23
-rwxr-xr-xflags/tests/parse.ts93
-rwxr-xr-xflags/tests/short.ts23
-rwxr-xr-xflags/tests/stop_early.ts5
-rwxr-xr-xflags/tests/unknown.ts17
-rwxr-xr-xflags/tests/whitespace.ts5
13 files changed, 155 insertions, 141 deletions
diff --git a/flags/tests/all_bool.ts b/flags/tests/all_bool.ts
index 80e469f18..7f19e5303 100755
--- a/flags/tests/all_bool.ts
+++ b/flags/tests/all_bool.ts
@@ -1,5 +1,6 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-import { test, assertEqual } from "../../testing/mod.ts";
+import { test } from "../../testing/mod.ts";
+import { assertEq } from "../../testing/asserts.ts";
import { parse } from "../mod.ts";
// flag boolean true (default all --args to boolean)
@@ -8,12 +9,12 @@ test(function flagBooleanTrue() {
boolean: true
});
- assertEqual(argv, {
+ assertEq(argv, {
honk: true,
_: ["moo", "cow"]
});
- assertEqual(typeof argv.honk, "boolean");
+ assertEq(typeof argv.honk, "boolean");
});
// flag boolean true only affects double hyphen arguments without equals signs
@@ -22,12 +23,12 @@ test(function flagBooleanTrueOnlyAffectsDoubleDash() {
boolean: true
});
- assertEqual(argv, {
+ assertEq(argv, {
honk: true,
tacos: "good",
p: 55,
_: ["moo", "cow"]
});
- assertEqual(typeof argv.honk, "boolean");
+ assertEq(typeof argv.honk, "boolean");
});
diff --git a/flags/tests/bool.ts b/flags/tests/bool.ts
index 6e3da2e73..1146698fa 100755
--- a/flags/tests/bool.ts
+++ b/flags/tests/bool.ts
@@ -1,5 +1,6 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-import { test, assertEqual } from "../../testing/mod.ts";
+import { test } from "../../testing/mod.ts";
+import { assertEq } from "../../testing/asserts.ts";
import { parse } from "../mod.ts";
test(function flagBooleanDefaultFalse() {
@@ -8,14 +9,14 @@ test(function flagBooleanDefaultFalse() {
default: { verbose: false, t: false }
});
- assertEqual(argv, {
+ assertEq(argv, {
verbose: false,
t: false,
_: ["moo"]
});
- assertEqual(typeof argv.verbose, "boolean");
- assertEqual(typeof argv.t, "boolean");
+ assertEq(typeof argv.verbose, "boolean");
+ assertEq(typeof argv.t, "boolean");
});
test(function booleanGroups() {
@@ -23,16 +24,16 @@ test(function booleanGroups() {
boolean: ["x", "y", "z"]
});
- assertEqual(argv, {
+ assertEq(argv, {
x: true,
y: false,
z: true,
_: ["one", "two", "three"]
});
- assertEqual(typeof argv.x, "boolean");
- assertEqual(typeof argv.y, "boolean");
- assertEqual(typeof argv.z, "boolean");
+ assertEq(typeof argv.x, "boolean");
+ assertEq(typeof argv.y, "boolean");
+ assertEq(typeof argv.z, "boolean");
});
test(function booleanAndAliasWithChainableApi() {
@@ -55,8 +56,8 @@ test(function booleanAndAliasWithChainableApi() {
_: ["derp"]
};
- assertEqual(aliasedArgv, expected);
- assertEqual(propertyArgv, expected);
+ assertEq(aliasedArgv, expected);
+ assertEq(propertyArgv, expected);
});
test(function booleanAndAliasWithOptionsHash() {
@@ -73,8 +74,8 @@ test(function booleanAndAliasWithOptionsHash() {
h: true,
_: ["derp"]
};
- assertEqual(aliasedArgv, expected);
- assertEqual(propertyArgv, expected);
+ assertEq(aliasedArgv, expected);
+ assertEq(propertyArgv, expected);
});
test(function booleanAndAliasArrayWithOptionsHash() {
@@ -94,9 +95,9 @@ test(function booleanAndAliasArrayWithOptionsHash() {
h: true,
_: ["derp"]
};
- assertEqual(aliasedArgv, expected);
- assertEqual(propertyArgv, expected);
- assertEqual(altPropertyArgv, expected);
+ assertEq(aliasedArgv, expected);
+ assertEq(propertyArgv, expected);
+ assertEq(altPropertyArgv, expected);
});
test(function booleanAndAliasUsingExplicitTrue() {
@@ -114,8 +115,8 @@ test(function booleanAndAliasUsingExplicitTrue() {
_: []
};
- assertEqual(aliasedArgv, expected);
- assertEqual(propertyArgv, expected);
+ assertEq(aliasedArgv, expected);
+ assertEq(propertyArgv, expected);
});
// regression, see https://github.com/substack/node-optimist/issues/71
@@ -125,15 +126,15 @@ test(function booleanAndNonBoolean() {
boolean: "boool"
});
- assertEqual(parsed.boool, true);
- assertEqual(parsed.other, "true");
+ assertEq(parsed.boool, true);
+ assertEq(parsed.other, "true");
const parsed2 = parse(["--boool", "--other=false"], {
boolean: "boool"
});
- assertEqual(parsed2.boool, true);
- assertEqual(parsed2.other, "false");
+ assertEq(parsed2.boool, true);
+ assertEq(parsed2.other, "false");
});
test(function booleanParsingTrue() {
@@ -144,7 +145,7 @@ test(function booleanParsingTrue() {
boolean: ["boool"]
});
- assertEqual(parsed.boool, true);
+ assertEq(parsed.boool, true);
});
test(function booleanParsingFalse() {
@@ -155,5 +156,5 @@ test(function booleanParsingFalse() {
boolean: ["boool"]
});
- assertEqual(parsed.boool, false);
+ assertEq(parsed.boool, false);
});
diff --git a/flags/tests/dash.ts b/flags/tests/dash.ts
index d9f54c692..13fa153cb 100755
--- a/flags/tests/dash.ts
+++ b/flags/tests/dash.ts
@@ -1,24 +1,26 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-import { test, assertEqual } from "../../testing/mod.ts";
+import { test } from "../../testing/mod.ts";
+import { assertEq } from "../../testing/asserts.ts";
import { parse } from "../mod.ts";
test(function hyphen() {
- assertEqual(parse(["-n", "-"]), { n: "-", _: [] });
- assertEqual(parse(["-"]), { _: ["-"] });
- assertEqual(parse(["-f-"]), { f: "-", _: [] });
- assertEqual(parse(["-b", "-"], { boolean: "b" }), { b: true, _: ["-"] });
- assertEqual(parse(["-s", "-"], { string: "s" }), { s: "-", _: [] });
+ assertEq(parse(["-n", "-"]), { n: "-", _: [] });
+ assertEq(parse(["-"]), { _: ["-"] });
+ assertEq(parse(["-f-"]), { f: "-", _: [] });
+ assertEq(parse(["-b", "-"], { boolean: "b" }), { b: true, _: ["-"] });
+ assertEq(parse(["-s", "-"], { string: "s" }), { s: "-", _: [] });
});
test(function doubleDash() {
- assertEqual(parse(["-a", "--", "b"]), { a: true, _: ["b"] });
- assertEqual(parse(["--a", "--", "b"]), { a: true, _: ["b"] });
- assertEqual(parse(["--a", "--", "b"]), { a: true, _: ["b"] });
+ assertEq(parse(["-a", "--", "b"]), { a: true, _: ["b"] });
+ assertEq(parse(["--a", "--", "b"]), { a: true, _: ["b"] });
+ assertEq(parse(["--a", "--", "b"]), { a: true, _: ["b"] });
});
test(function moveArgsAfterDoubleDashIntoOwnArray() {
- assertEqual(
- parse(["--name", "John", "before", "--", "after"], { "--": true }),
- { name: "John", _: ["before"], "--": ["after"] }
- );
+ assertEq(parse(["--name", "John", "before", "--", "after"], { "--": true }), {
+ name: "John",
+ _: ["before"],
+ "--": ["after"]
+ });
});
diff --git a/flags/tests/default_bool.ts b/flags/tests/default_bool.ts
index ed5564715..9c4855c7d 100755
--- a/flags/tests/default_bool.ts
+++ b/flags/tests/default_bool.ts
@@ -1,5 +1,6 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-import { test, assertEqual } from "../../testing/mod.ts";
+import { test } from "../../testing/mod.ts";
+import { assertEq } from "../../testing/asserts.ts";
import { parse } from "../mod.ts";
test(function booleanDefaultTrue() {
@@ -7,7 +8,7 @@ test(function booleanDefaultTrue() {
boolean: "sometrue",
default: { sometrue: true }
});
- assertEqual(argv.sometrue, true);
+ assertEq(argv.sometrue, true);
});
test(function booleanDefaultFalse() {
@@ -15,7 +16,7 @@ test(function booleanDefaultFalse() {
boolean: "somefalse",
default: { somefalse: false }
});
- assertEqual(argv.somefalse, false);
+ assertEq(argv.somefalse, false);
});
test(function booleanDefaultNull() {
@@ -23,10 +24,10 @@ test(function booleanDefaultNull() {
boolean: "maybe",
default: { maybe: null }
});
- assertEqual(argv.maybe, null);
+ assertEq(argv.maybe, null);
const argv2 = parse(["--maybe"], {
boolean: "maybe",
default: { maybe: null }
});
- assertEqual(argv2.maybe, true);
+ assertEq(argv2.maybe, true);
});
diff --git a/flags/tests/dotted.ts b/flags/tests/dotted.ts
index 31b73c85d..55addefe7 100755
--- a/flags/tests/dotted.ts
+++ b/flags/tests/dotted.ts
@@ -1,5 +1,6 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-import { test, assertEqual } from "../../testing/mod.ts";
+import { test } from "../../testing/mod.ts";
+import { assertEq } from "../../testing/asserts.ts";
import { parse } from "../mod.ts";
test(function dottedAlias() {
@@ -7,17 +8,17 @@ test(function dottedAlias() {
default: { "a.b": 11 },
alias: { "a.b": "aa.bb" }
});
- assertEqual(argv.a.b, 22);
- assertEqual(argv.aa.bb, 22);
+ assertEq(argv.a.b, 22);
+ assertEq(argv.aa.bb, 22);
});
test(function dottedDefault() {
const argv = parse("", { default: { "a.b": 11 }, alias: { "a.b": "aa.bb" } });
- assertEqual(argv.a.b, 11);
- assertEqual(argv.aa.bb, 11);
+ assertEq(argv.a.b, 11);
+ assertEq(argv.aa.bb, 11);
});
test(function dottedDefaultWithNoAlias() {
const argv = parse("", { default: { "a.b": 11 } });
- assertEqual(argv.a.b, 11);
+ assertEq(argv.a.b, 11);
});
diff --git a/flags/tests/kv_short.ts b/flags/tests/kv_short.ts
index f2440919b..967c8a1db 100755
--- a/flags/tests/kv_short.ts
+++ b/flags/tests/kv_short.ts
@@ -1,13 +1,14 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-import { test, assertEqual } from "../../testing/mod.ts";
+import { test } from "../../testing/mod.ts";
+import { assertEq } from "../../testing/asserts.ts";
import { parse } from "../mod.ts";
test(function short() {
const argv = parse(["-b=123"]);
- assertEqual(argv, { b: 123, _: [] });
+ assertEq(argv, { b: 123, _: [] });
});
test(function multiShort() {
const argv = parse(["-a=whatever", "-b=robots"]);
- assertEqual(argv, { a: "whatever", b: "robots", _: [] });
+ assertEq(argv, { a: "whatever", b: "robots", _: [] });
});
diff --git a/flags/tests/long.ts b/flags/tests/long.ts
index 9ea7df471..a67febe19 100755
--- a/flags/tests/long.ts
+++ b/flags/tests/long.ts
@@ -1,17 +1,18 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-import { test, assertEqual } from "../../testing/mod.ts";
+import { test } from "../../testing/mod.ts";
+import { assertEq } from "../../testing/asserts.ts";
import { parse } from "../mod.ts";
test(function longOpts() {
- assertEqual(parse(["--bool"]), { bool: true, _: [] });
- assertEqual(parse(["--pow", "xixxle"]), { pow: "xixxle", _: [] });
- assertEqual(parse(["--pow=xixxle"]), { pow: "xixxle", _: [] });
- assertEqual(parse(["--host", "localhost", "--port", "555"]), {
+ assertEq(parse(["--bool"]), { bool: true, _: [] });
+ assertEq(parse(["--pow", "xixxle"]), { pow: "xixxle", _: [] });
+ assertEq(parse(["--pow=xixxle"]), { pow: "xixxle", _: [] });
+ assertEq(parse(["--host", "localhost", "--port", "555"]), {
host: "localhost",
port: 555,
_: []
});
- assertEqual(parse(["--host=localhost", "--port=555"]), {
+ assertEq(parse(["--host=localhost", "--port=555"]), {
host: "localhost",
port: 555,
_: []
diff --git a/flags/tests/num.ts b/flags/tests/num.ts
index a3b564e7e..9e9e2a3c4 100755
--- a/flags/tests/num.ts
+++ b/flags/tests/num.ts
@@ -1,5 +1,6 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-import { test, assertEqual } from "../../testing/mod.ts";
+import { test } from "../../testing/mod.ts";
+import { assertEq } from "../../testing/asserts.ts";
import { parse } from "../mod.ts";
test(function nums() {
@@ -16,7 +17,7 @@ test(function nums() {
"0xdeadbeef",
"789"
]);
- assertEqual(argv, {
+ assertEq(argv, {
x: 1234,
y: 5.67,
z: 1e7,
@@ -24,17 +25,17 @@ test(function nums() {
hex: 0xdeadbeef,
_: [789]
});
- assertEqual(typeof argv.x, "number");
- assertEqual(typeof argv.y, "number");
- assertEqual(typeof argv.z, "number");
- assertEqual(typeof argv.w, "string");
- assertEqual(typeof argv.hex, "number");
- assertEqual(typeof argv._[0], "number");
+ assertEq(typeof argv.x, "number");
+ assertEq(typeof argv.y, "number");
+ assertEq(typeof argv.z, "number");
+ assertEq(typeof argv.w, "string");
+ assertEq(typeof argv.hex, "number");
+ assertEq(typeof argv._[0], "number");
});
test(function alreadyNumber() {
const argv = parse(["-x", 1234, 789]);
- assertEqual(argv, { x: 1234, _: [789] });
- assertEqual(typeof argv.x, "number");
- assertEqual(typeof argv._[0], "number");
+ assertEq(argv, { x: 1234, _: [789] });
+ assertEq(typeof argv.x, "number");
+ assertEq(typeof argv._[0], "number");
});
diff --git a/flags/tests/parse.ts b/flags/tests/parse.ts
index d6a1be709..d58c67029 100755
--- a/flags/tests/parse.ts
+++ b/flags/tests/parse.ts
@@ -1,17 +1,18 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-import { test, assertEqual } from "../../testing/mod.ts";
+import { test } from "../../testing/mod.ts";
+import { assertEq } from "../../testing/asserts.ts";
import { parse } from "../mod.ts";
test(function _arseArgs() {
- assertEqual(parse(["--no-moo"]), { moo: false, _: [] });
- assertEqual(parse(["-v", "a", "-v", "b", "-v", "c"]), {
+ assertEq(parse(["--no-moo"]), { moo: false, _: [] });
+ assertEq(parse(["-v", "a", "-v", "b", "-v", "c"]), {
v: ["a", "b", "c"],
_: []
});
});
test(function comprehensive() {
- assertEqual(
+ assertEq(
parse([
"--name=meowmers",
"bare",
@@ -49,8 +50,8 @@ test(function comprehensive() {
test(function flagBoolean() {
const argv = parse(["-t", "moo"], { boolean: "t" });
- assertEqual(argv, { t: true, _: ["moo"] });
- assertEqual(typeof argv.t, "boolean");
+ assertEq(argv, { t: true, _: ["moo"] });
+ assertEq(typeof argv.t, "boolean");
});
test(function flagBooleanValue() {
@@ -59,63 +60,63 @@ test(function flagBooleanValue() {
default: { verbose: true }
});
- assertEqual(argv, {
+ assertEq(argv, {
verbose: false,
t: true,
_: ["moo"]
});
- assertEqual(typeof argv.verbose, "boolean");
- assertEqual(typeof argv.t, "boolean");
+ assertEq(typeof argv.verbose, "boolean");
+ assertEq(typeof argv.t, "boolean");
});
test(function newlinesInParams() {
const args = parse(["-s", "X\nX"]);
- assertEqual(args, { _: [], s: "X\nX" });
+ assertEq(args, { _: [], s: "X\nX" });
// reproduce in bash:
// VALUE="new
// line"
// deno program.js --s="$VALUE"
const args2 = parse(["--s=X\nX"]);
- assertEqual(args2, { _: [], s: "X\nX" });
+ assertEq(args2, { _: [], s: "X\nX" });
});
test(function strings() {
const s = parse(["-s", "0001234"], { string: "s" }).s;
- assertEqual(s, "0001234");
- assertEqual(typeof s, "string");
+ assertEq(s, "0001234");
+ assertEq(typeof s, "string");
const x = parse(["-x", "56"], { string: "x" }).x;
- assertEqual(x, "56");
- assertEqual(typeof x, "string");
+ assertEq(x, "56");
+ assertEq(typeof x, "string");
});
test(function stringArgs() {
const s = parse([" ", " "], { string: "_" })._;
- assertEqual(s.length, 2);
- assertEqual(typeof s[0], "string");
- assertEqual(s[0], " ");
- assertEqual(typeof s[1], "string");
- assertEqual(s[1], " ");
+ assertEq(s.length, 2);
+ assertEq(typeof s[0], "string");
+ assertEq(s[0], " ");
+ assertEq(typeof s[1], "string");
+ assertEq(s[1], " ");
});
test(function emptyStrings() {
const s = parse(["-s"], { string: "s" }).s;
- assertEqual(s, "");
- assertEqual(typeof s, "string");
+ assertEq(s, "");
+ assertEq(typeof s, "string");
const str = parse(["--str"], { string: "str" }).str;
- assertEqual(str, "");
- assertEqual(typeof str, "string");
+ assertEq(str, "");
+ assertEq(typeof str, "string");
const letters = parse(["-art"], {
string: ["a", "t"]
});
- assertEqual(letters.a, "");
- assertEqual(letters.r, true);
- assertEqual(letters.t, "");
+ assertEq(letters.a, "");
+ assertEq(letters.r, true);
+ assertEq(letters.t, "");
});
test(function stringAndAlias() {
@@ -124,25 +125,25 @@ test(function stringAndAlias() {
alias: { s: "str" }
});
- assertEqual(x.str, "000123");
- assertEqual(typeof x.str, "string");
- assertEqual(x.s, "000123");
- assertEqual(typeof x.s, "string");
+ assertEq(x.str, "000123");
+ assertEq(typeof x.str, "string");
+ assertEq(x.s, "000123");
+ assertEq(typeof x.s, "string");
const y = parse(["-s", "000123"], {
string: "str",
alias: { str: "s" }
});
- assertEqual(y.str, "000123");
- assertEqual(typeof y.str, "string");
- assertEqual(y.s, "000123");
- assertEqual(typeof y.s, "string");
+ assertEq(y.str, "000123");
+ assertEq(typeof y.str, "string");
+ assertEq(y.s, "000123");
+ assertEq(typeof y.s, "string");
});
test(function slashBreak() {
- assertEqual(parse(["-I/foo/bar/baz"]), { I: "/foo/bar/baz", _: [] });
- assertEqual(parse(["-xyz/foo/bar/baz"]), {
+ assertEq(parse(["-I/foo/bar/baz"]), { I: "/foo/bar/baz", _: [] });
+ assertEq(parse(["-xyz/foo/bar/baz"]), {
x: true,
y: true,
z: "/foo/bar/baz",
@@ -154,19 +155,19 @@ test(function alias() {
const argv = parse(["-f", "11", "--zoom", "55"], {
alias: { z: "zoom" }
});
- assertEqual(argv.zoom, 55);
- assertEqual(argv.z, argv.zoom);
- assertEqual(argv.f, 11);
+ assertEq(argv.zoom, 55);
+ assertEq(argv.z, argv.zoom);
+ assertEq(argv.f, 11);
});
test(function multiAlias() {
const argv = parse(["-f", "11", "--zoom", "55"], {
alias: { z: ["zm", "zoom"] }
});
- assertEqual(argv.zoom, 55);
- assertEqual(argv.z, argv.zoom);
- assertEqual(argv.z, argv.zm);
- assertEqual(argv.f, 11);
+ assertEq(argv.zoom, 55);
+ assertEq(argv.z, argv.zoom);
+ assertEq(argv.z, argv.zm);
+ assertEq(argv.f, 11);
});
test(function nestedDottedObjects() {
@@ -181,7 +182,7 @@ test(function nestedDottedObjects() {
"--beep.boop"
]);
- assertEqual(argv.foo, {
+ assertEq(argv.foo, {
bar: 3,
baz: 4,
quux: {
@@ -189,5 +190,5 @@ test(function nestedDottedObjects() {
o_O: true
}
});
- assertEqual(argv.beep, { boop: true });
+ assertEq(argv.beep, { boop: true });
});
diff --git a/flags/tests/short.ts b/flags/tests/short.ts
index 84edd483e..48462af2f 100755
--- a/flags/tests/short.ts
+++ b/flags/tests/short.ts
@@ -1,25 +1,26 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-import { test, assertEqual } from "../../testing/mod.ts";
+import { test } from "../../testing/mod.ts";
+import { assertEq } from "../../testing/asserts.ts";
import { parse } from "../mod.ts";
test(function numbericShortArgs() {
- assertEqual(parse(["-n123"]), { n: 123, _: [] });
- assertEqual(parse(["-123", "456"]), { 1: true, 2: true, 3: 456, _: [] });
+ assertEq(parse(["-n123"]), { n: 123, _: [] });
+ assertEq(parse(["-123", "456"]), { 1: true, 2: true, 3: 456, _: [] });
});
test(function short() {
- assertEqual(parse(["-b"]), { b: true, _: [] });
- assertEqual(parse(["foo", "bar", "baz"]), { _: ["foo", "bar", "baz"] });
- assertEqual(parse(["-cats"]), { c: true, a: true, t: true, s: true, _: [] });
- assertEqual(parse(["-cats", "meow"]), {
+ assertEq(parse(["-b"]), { b: true, _: [] });
+ assertEq(parse(["foo", "bar", "baz"]), { _: ["foo", "bar", "baz"] });
+ assertEq(parse(["-cats"]), { c: true, a: true, t: true, s: true, _: [] });
+ assertEq(parse(["-cats", "meow"]), {
c: true,
a: true,
t: true,
s: "meow",
_: []
});
- assertEqual(parse(["-h", "localhost"]), { h: "localhost", _: [] });
- assertEqual(parse(["-h", "localhost", "-p", "555"]), {
+ assertEq(parse(["-h", "localhost"]), { h: "localhost", _: [] });
+ assertEq(parse(["-h", "localhost", "-p", "555"]), {
h: "localhost",
p: 555,
_: []
@@ -27,7 +28,7 @@ test(function short() {
});
test(function mixedShortBoolAndCapture() {
- assertEqual(parse(["-h", "localhost", "-fp", "555", "script.js"]), {
+ assertEq(parse(["-h", "localhost", "-fp", "555", "script.js"]), {
f: true,
p: 555,
h: "localhost",
@@ -36,7 +37,7 @@ test(function mixedShortBoolAndCapture() {
});
test(function shortAndLong() {
- assertEqual(parse(["-h", "localhost", "-fp", "555", "script.js"]), {
+ assertEq(parse(["-h", "localhost", "-fp", "555", "script.js"]), {
f: true,
p: 555,
h: "localhost",
diff --git a/flags/tests/stop_early.ts b/flags/tests/stop_early.ts
index 5e171accd..5f320e8b8 100755
--- a/flags/tests/stop_early.ts
+++ b/flags/tests/stop_early.ts
@@ -1,5 +1,6 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-import { test, assertEqual } from "../../testing/mod.ts";
+import { test } from "../../testing/mod.ts";
+import { assertEq } from "../../testing/asserts.ts";
import { parse } from "../mod.ts";
// stops parsing on the first non-option when stopEarly is set
@@ -8,7 +9,7 @@ test(function stopParsing() {
stopEarly: true
});
- assertEqual(argv, {
+ assertEq(argv, {
aaa: "bbb",
_: ["ccc", "--ddd"]
});
diff --git a/flags/tests/unknown.ts b/flags/tests/unknown.ts
index ba1023dbe..f69d55d09 100755
--- a/flags/tests/unknown.ts
+++ b/flags/tests/unknown.ts
@@ -1,5 +1,6 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-import { test, assertEqual } from "../../testing/mod.ts";
+import { test } from "../../testing/mod.ts";
+import { assertEq } from "../../testing/asserts.ts";
import { parse } from "../mod.ts";
test(function booleanAndAliasIsNotUnknown() {
@@ -18,7 +19,7 @@ test(function booleanAndAliasIsNotUnknown() {
const aliasedArgv = parse(aliased, opts);
const propertyArgv = parse(regular, opts);
- assertEqual(unknown, ["--derp", "-d"]);
+ assertEq(unknown, ["--derp", "-d"]);
});
test(function flagBooleanTrueAnyDoubleHyphenArgumentIsNotUnknown() {
@@ -31,8 +32,8 @@ test(function flagBooleanTrueAnyDoubleHyphenArgumentIsNotUnknown() {
boolean: true,
unknown: unknownFn
});
- assertEqual(unknown, ["--tacos=good", "cow", "-p"]);
- assertEqual(argv, {
+ assertEq(unknown, ["--tacos=good", "cow", "-p"]);
+ assertEq(argv, {
honk: true,
_: []
});
@@ -54,7 +55,7 @@ test(function stringAndAliasIsNotUnkown() {
const aliasedArgv = parse(aliased, opts);
const propertyArgv = parse(regular, opts);
- assertEqual(unknown, ["--derp", "-d"]);
+ assertEq(unknown, ["--derp", "-d"]);
});
test(function defaultAndAliasIsNotUnknown() {
@@ -73,7 +74,7 @@ test(function defaultAndAliasIsNotUnknown() {
const aliasedArgv = parse(aliased, opts);
const propertyArgv = parse(regular, opts);
- assertEqual(unknown, []);
+ assertEq(unknown, []);
});
test(function valueFollowingDoubleHyphenIsNotUnknown() {
@@ -89,8 +90,8 @@ test(function valueFollowingDoubleHyphenIsNotUnknown() {
};
const argv = parse(aliased, opts);
- assertEqual(unknown, ["--bad"]);
- assertEqual(argv, {
+ assertEq(unknown, ["--bad"]);
+ assertEq(argv, {
"--": ["good", "arg"],
_: []
});
diff --git a/flags/tests/whitespace.ts b/flags/tests/whitespace.ts
index 4dd9f9783..22021e5ea 100755
--- a/flags/tests/whitespace.ts
+++ b/flags/tests/whitespace.ts
@@ -1,7 +1,8 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-import { test, assertEqual } from "../../testing/mod.ts";
+import { test } from "../../testing/mod.ts";
+import { assertEq } from "../../testing/asserts.ts";
import { parse } from "../mod.ts";
test(function whitespaceShouldBeWhitespace() {
- assertEqual(parse(["-x", "\t"]).x, "\t");
+ assertEq(parse(["-x", "\t"]).x, "\t");
});