diff options
Diffstat (limited to 'cli/tests/unit/console_test.ts')
-rw-r--r-- | cli/tests/unit/console_test.ts | 122 |
1 files changed, 61 insertions, 61 deletions
diff --git a/cli/tests/unit/console_test.ts b/cli/tests/unit/console_test.ts index 7a03cd6b6..bc97107b1 100644 --- a/cli/tests/unit/console_test.ts +++ b/cli/tests/unit/console_test.ts @@ -155,7 +155,7 @@ unitTest(function consoleTestStringifyCircular(): void { assertEquals(stringify(/[0-9]*/), "/[0-9]*/"); assertEquals( stringify(new Date("2018-12-10T02:26:59.002Z")), - "2018-12-10T02:26:59.002Z" + "2018-12-10T02:26:59.002Z", ); assertEquals(stringify(new Set([1, 2, 3])), "Set { 1, 2, 3 }"); assertEquals( @@ -163,9 +163,9 @@ unitTest(function consoleTestStringifyCircular(): void { new Map([ [1, "one"], [2, "two"], - ]) + ]), ), - `Map { 1 => "one", 2 => "two" }` + `Map { 1 => "one", 2 => "two" }`, ); assertEquals(stringify(new WeakSet()), "WeakSet { [items unknown] }"); assertEquals(stringify(new WeakMap()), "WeakMap { [items unknown] }"); @@ -175,28 +175,28 @@ unitTest(function consoleTestStringifyCircular(): void { assertEquals(stringify(new Extended()), "Extended { a: 1, b: 2 }"); assertEquals( stringify(function f(): void {}), - "[Function: f]" + "[Function: f]", ); assertEquals( stringify(async function af(): Promise<void> {}), - "[AsyncFunction: af]" + "[AsyncFunction: af]", ); assertEquals( stringify(function* gf() {}), - "[GeneratorFunction: gf]" + "[GeneratorFunction: gf]", ); assertEquals( stringify(async function* agf() {}), - "[AsyncGeneratorFunction: agf]" + "[AsyncGeneratorFunction: agf]", ); assertEquals( stringify(new Uint8Array([1, 2, 3])), - "Uint8Array(3) [ 1, 2, 3 ]" + "Uint8Array(3) [ 1, 2, 3 ]", ); assertEquals(stringify(Uint8Array.prototype), "TypedArray {}"); assertEquals( stringify({ a: { b: { c: { d: new Set([1]) } } } }), - "{ a: { b: { c: { d: [Set] } } } }" + "{ a: { b: { c: { d: [Set] } } } }", ); assertEquals(stringify(nestedObj), nestedObjExpected); assertEquals(stringify(JSON), 'JSON { Symbol(Symbol.toStringTag): "JSON" }'); @@ -224,11 +224,11 @@ unitTest(function consoleTestStringifyCircular(): void { trace: [Function], indentLevel: 0, Symbol(isConsoleInstance): true -}` +}`, ); assertEquals( stringify({ str: 1, [Symbol.for("sym")]: 2, [Symbol.toStringTag]: "TAG" }), - 'TAG { str: 1, Symbol(sym): 2, Symbol(Symbol.toStringTag): "TAG" }' + 'TAG { str: 1, Symbol(sym): 2, Symbol(Symbol.toStringTag): "TAG" }', ); // test inspect is working the same assertEquals(stripColor(Deno.inspect(nestedObj)), nestedObjExpected); @@ -240,21 +240,21 @@ unitTest(function consoleTestStringifyWithDepth(): void { const nestedObj: any = { a: { b: { c: { d: { e: { f: 42 } } } } } }; assertEquals( stripColor(inspectArgs([nestedObj], { depth: 3 })), - "{ a: { b: { c: [Object] } } }" + "{ a: { b: { c: [Object] } } }", ); assertEquals( stripColor(inspectArgs([nestedObj], { depth: 4 })), - "{ a: { b: { c: { d: [Object] } } } }" + "{ a: { b: { c: { d: [Object] } } } }", ); assertEquals(stripColor(inspectArgs([nestedObj], { depth: 0 })), "[Object]"); assertEquals( stripColor(inspectArgs([nestedObj])), - "{ a: { b: { c: { d: [Object] } } } }" + "{ a: { b: { c: { d: [Object] } } } }", ); // test inspect is working the same way assertEquals( stripColor(Deno.inspect(nestedObj, { depth: 4 })), - "{ a: { b: { c: { d: [Object] } } } }" + "{ a: { b: { c: { d: [Object] } } } }", ); }); @@ -290,7 +290,7 @@ unitTest(function consoleTestStringifyLargeObject(): void { asda: 3, x: { a: "asd", x: 3 } } -}` +}`, ); }); @@ -310,7 +310,7 @@ unitTest(function consoleTestStringifyIterable() { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... 100 more items -]` +]`, ); const obj = { a: "a", longArray }; @@ -328,7 +328,7 @@ unitTest(function consoleTestStringifyIterable() { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... 100 more items ] -}` +}`, ); const shortMap = new Map([ @@ -445,7 +445,7 @@ unitTest(function consoleTestStringifyIterable() { "98" => 98, "99" => 99, ... 100 more items -}` +}`, ); const shortSet = new Set([1, 2, 3]); @@ -558,14 +558,14 @@ unitTest(function consoleTestStringifyIterable() { 98, 99, ... 100 more items -}` +}`, ); const withEmptyEl = Array(10); withEmptyEl.fill(0, 4, 6); assertEquals( stringify(withEmptyEl), - `[ <4 empty items>, 0, 0, <4 empty items> ]` + `[ <4 empty items>, 0, 0, <4 empty items> ]`, ); /* TODO(ry) Fix this test @@ -643,7 +643,7 @@ unitTest(function consoleTestWithCustomInspectorError(): void { assertEquals(stringify(new B({ a: "a" })), "a"); assertEquals( stringify(B.prototype), - "{ Symbol(Deno.customInspect): [Function: [Deno.customInspect]] }" + "{ Symbol(Deno.customInspect): [Function: [Deno.customInspect]] }", ); }); @@ -662,7 +662,7 @@ unitTest(function consoleTestWithIntegerFormatSpecifier(): void { assertEquals(stringify("%d", 12345678901234567890123), "1"); assertEquals( stringify("%i", 12345678901234567890123n), - "12345678901234567890123n" + "12345678901234567890123n", ); }); @@ -701,7 +701,7 @@ unitTest(function consoleTestWithObjectFormatSpecifier(): void { assertEquals(stringify("%o", { a: 42 }), "{ a: 42 }"); assertEquals( stringify("%o", { a: { b: { c: { d: new Set([1]) } } } }), - "{ a: { b: { c: { d: [Set] } } } }" + "{ a: { b: { c: { d: [Set] } } } }", ); }); @@ -749,7 +749,7 @@ unitTest(function consoleTestError(): void { assert( stringify(e) .split("\n")[0] // error has been caught - .includes("MyError: This is an error") + .includes("MyError: This is an error"), ); } }); @@ -816,7 +816,7 @@ type ConsoleExamineFunc = ( csl: any, out: StringBuffer, err?: StringBuffer, - both?: StringBuffer + both?: StringBuffer, ) => void; function mockConsole(f: ConsoleExamineFunc): void { @@ -829,7 +829,7 @@ function mockConsole(f: ConsoleExamineFunc): void { const buf = isErr ? err : out; buf.add(content); both.add(content); - } + }, ); f(csl, out, err, both); } @@ -854,7 +854,7 @@ unitTest(function consoleGroup(): void { 4 5 6 -` +`, ); }); }); @@ -884,7 +884,7 @@ unitTest(function consoleGroupWarn(): void { 5 6 7 -` +`, ); }); }); @@ -901,7 +901,7 @@ unitTest(function consoleTable(): void { │ a │ "test" │ │ b │ 1 │ └───────┴────────┘ -` +`, ); }); mockConsole((console, out): void => { @@ -914,7 +914,7 @@ unitTest(function consoleTable(): void { │ a │ │ │ b │ 30 │ └───────┴────┘ -` +`, ); }); mockConsole((console, out): void => { @@ -930,7 +930,7 @@ unitTest(function consoleTable(): void { │ 3 │ 5 │ 6 │ │ │ 4 │ [ 7 ] │ [ 8 ] │ │ └───────┴───────┴───────┴────────┘ -` +`, ); }); mockConsole((console, out): void => { @@ -945,7 +945,7 @@ unitTest(function consoleTable(): void { │ 2 │ 3 │ │ 3 │ "test" │ └────────────┴────────┘ -` +`, ); }); mockConsole((console, out): void => { @@ -953,7 +953,7 @@ unitTest(function consoleTable(): void { new Map([ [1, "one"], [2, "two"], - ]) + ]), ); assertEquals( stripColor(out.toString()), @@ -963,7 +963,7 @@ unitTest(function consoleTable(): void { │ 0 │ 1 │ "one" │ │ 1 │ 2 │ "two" │ └────────────┴─────┴────────┘ -` +`, ); }); mockConsole((console, out): void => { @@ -985,7 +985,7 @@ unitTest(function consoleTable(): void { │ g │ │ │ │ │ h │ │ │ │ └───────┴───────────┴───────────────────┴────────┘ -` +`, ); }); mockConsole((console, out): void => { @@ -1007,7 +1007,7 @@ unitTest(function consoleTable(): void { │ 3 │ │ │ 10 │ │ │ 4 │ "test" │ { b: 20, c: "test" } │ │ │ └───────┴────────┴──────────────────────┴────┴────────┘ -` +`, ); }); mockConsole((console, out): void => { @@ -1018,7 +1018,7 @@ unitTest(function consoleTable(): void { │ (idx) │ ├───────┤ └───────┘ -` +`, ); }); mockConsole((console, out): void => { @@ -1029,7 +1029,7 @@ unitTest(function consoleTable(): void { │ (idx) │ ├───────┤ └───────┘ -` +`, ); }); mockConsole((console, out): void => { @@ -1040,7 +1040,7 @@ unitTest(function consoleTable(): void { │ (iter idx) │ ├────────────┤ └────────────┘ -` +`, ); }); mockConsole((console, out): void => { @@ -1051,7 +1051,7 @@ unitTest(function consoleTable(): void { │ (iter idx) │ ├────────────┤ └────────────┘ -` +`, ); }); mockConsole((console, out): void => { @@ -1069,7 +1069,7 @@ unitTest(function consoleTable(): void { │ 1 │ "你好" │ │ 2 │ "Amapá" │ └───────┴─────────┘ -` +`, ); }); mockConsole((console, out): void => { @@ -1085,7 +1085,7 @@ unitTest(function consoleTable(): void { │ 0 │ 1 │ 2 │ │ 1 │ 3 │ 4 │ └───────┴───┴───┘ -` +`, ); }); mockConsole((console, out): void => { @@ -1099,7 +1099,7 @@ unitTest(function consoleTable(): void { │ 2 │ │ │ 3 │ 6 │ └───────┴───┘ -` +`, ); }); }); @@ -1169,11 +1169,11 @@ unitTest(function consoleTrace(): void { unitTest(function inspectSorted(): void { assertEquals( Deno.inspect({ b: 2, a: 1 }, { sorted: true }), - "{ a: 1, b: 2 }" + "{ a: 1, b: 2 }", ); assertEquals( Deno.inspect(new Set(["b", "a"]), { sorted: true }), - `Set { "a", "b" }` + `Set { "a", "b" }`, ); assertEquals( Deno.inspect( @@ -1181,9 +1181,9 @@ unitTest(function inspectSorted(): void { ["b", 2], ["a", 1], ]), - { sorted: true } + { sorted: true }, ), - `Map { "a" => 1, "b" => 2 }` + `Map { "a" => 1, "b" => 2 }`, ); }); @@ -1194,12 +1194,12 @@ unitTest(function inspectTrailingComma(): void { "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", ], - { trailingComma: true } + { trailingComma: true }, ), `[ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", -]` +]`, ); assertEquals( Deno.inspect( @@ -1207,12 +1207,12 @@ unitTest(function inspectTrailingComma(): void { aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa: 1, bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb: 2, }, - { trailingComma: true } + { trailingComma: true }, ), `{ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa: 1, bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb: 2, -}` +}`, ); assertEquals( Deno.inspect( @@ -1220,12 +1220,12 @@ unitTest(function inspectTrailingComma(): void { "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", ]), - { trailingComma: true } + { trailingComma: true }, ), `Set { "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", -}` +}`, ); assertEquals( Deno.inspect( @@ -1233,12 +1233,12 @@ unitTest(function inspectTrailingComma(): void { ["aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", 1], ["bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", 2], ]), - { trailingComma: true } + { trailingComma: true }, ), `Map { "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" => 1, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" => 2, -}` +}`, ); }); @@ -1248,18 +1248,18 @@ unitTest(function inspectCompact(): void { `{ a: 1, b: 2 -}` +}`, ); }); unitTest(function inspectIterableLimit(): void { assertEquals( Deno.inspect(["a", "b", "c"], { iterableLimit: 2 }), - `[ "a", "b", ... 1 more items ]` + `[ "a", "b", ... 1 more items ]`, ); assertEquals( Deno.inspect(new Set(["a", "b", "c"]), { iterableLimit: 2 }), - `Set { "a", "b", ... 1 more items }` + `Set { "a", "b", ... 1 more items }`, ); assertEquals( Deno.inspect( @@ -1268,8 +1268,8 @@ unitTest(function inspectIterableLimit(): void { ["b", 2], ["c", 3], ]), - { iterableLimit: 2 } + { iterableLimit: 2 }, ), - `Map { "a" => 1, "b" => 2, ... 1 more items }` + `Map { "a" => 1, "b" => 2, ... 1 more items }`, ); }); |