summaryrefslogtreecommitdiff
path: root/cli/tests/unit/console_test.ts
diff options
context:
space:
mode:
authorMarcos Casagrande <marcoscvp90@gmail.com>2022-09-26 08:55:22 +0200
committerGitHub <noreply@github.com>2022-09-26 15:55:22 +0900
commitb73cb7bf9cd8825acda0d378a9afa1c3b1062f51 (patch)
tree357b079d028c319103ed61bb5c27d5122863cab1 /cli/tests/unit/console_test.ts
parent9a9dd12253a5c26df16dd14d61732110e1d1eb72 (diff)
perf(ext/console): break on iterableLimit & better sparse array handling (#15935)
Diffstat (limited to 'cli/tests/unit/console_test.ts')
-rw-r--r--cli/tests/unit/console_test.ts52
1 files changed, 49 insertions, 3 deletions
diff --git a/cli/tests/unit/console_test.ts b/cli/tests/unit/console_test.ts
index ad7c0caa7..0ddbe278c 100644
--- a/cli/tests/unit/console_test.ts
+++ b/cli/tests/unit/console_test.ts
@@ -759,7 +759,54 @@ Deno.test(function consoleTestStringifyIterable() {
`[ <4 empty items>, 0, 0, <4 empty items> ]`,
);
- /* TODO(ry) Fix this test
+ const emptyArray = Array(5000);
+ assertEquals(
+ stringify(emptyArray),
+ `[ <5000 empty items> ]`,
+ );
+
+ assertEquals(
+ stringify(Array(1)),
+ `[ <1 empty item> ]`,
+ );
+
+ const withEmptyElAndMoreItems = Array(500);
+ withEmptyElAndMoreItems.fill(0, 50, 80);
+ withEmptyElAndMoreItems.fill(2, 100, 120);
+ withEmptyElAndMoreItems.fill(3, 140, 160);
+ withEmptyElAndMoreItems.fill(4, 180);
+ assertEquals(
+ stringify(withEmptyElAndMoreItems),
+ `[
+ <50 empty items>, 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, 0, 0,
+ 0, 0, 0, <20 empty items>,
+ 2, 2, 2, 2,
+ 2, 2, 2, 2,
+ 2, 2, 2, 2,
+ 2, 2, 2, 2,
+ 2, 2, 2, 2,
+ <20 empty items>, 3, 3, 3,
+ 3, 3, 3, 3,
+ 3, 3, 3, 3,
+ 3, 3, 3, 3,
+ 3, 3, 3, 3,
+ 3, <20 empty items>, 4, 4,
+ 4, 4, 4, 4,
+ 4, 4, 4, 4,
+ 4, 4, 4, 4,
+ 4, 4, 4, 4,
+ 4, 4, 4, 4,
+ 4, 4, 4, 4,
+ ... 294 more items
+]`,
+ );
+
const lWithEmptyEl = Array(200);
lWithEmptyEl.fill(0, 50, 80);
assertEquals(
@@ -776,9 +823,8 @@ Deno.test(function consoleTestStringifyIterable() {
0, 0, 0,
0, 0, 0,
0, <120 empty items>
-]`
+]`,
);
- */
});
Deno.test(function consoleTestStringifyIterableWhenGrouped() {