diff options
Diffstat (limited to 'cli/tests/unit/console_test.ts')
-rw-r--r-- | cli/tests/unit/console_test.ts | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/cli/tests/unit/console_test.ts b/cli/tests/unit/console_test.ts index e20a91555..c36db8f4e 100644 --- a/cli/tests/unit/console_test.ts +++ b/cli/tests/unit/console_test.ts @@ -590,6 +590,84 @@ unitTest(function consoleTestStringifyIterable() { */ }); +unitTest(function consoleTestStringifyIterableWhenGrouped(): void { + const withOddNumberOfEls = new Float64Array( + [ + 2.1, + 2.01, + 2.001, + 2.0001, + 2.00001, + 2.000001, + 2.0000001, + 2.00000001, + 2.000000001, + 2.0000000001, + 2, + ], + ); + assertEquals( + stringify(withOddNumberOfEls), + `Float64Array(11) [ + 2.1, 2.01, + 2.001, 2.0001, + 2.00001, 2.000001, + 2.0000001, 2.00000001, + 2.000000001, 2.0000000001, + 2 +]`, + ); + const withEvenNumberOfEls = new Float64Array( + [ + 2.1, + 2.01, + 2.001, + 2.0001, + 2.00001, + 2.000001, + 2.0000001, + 2.00000001, + 2.000000001, + 2.0000000001, + 2, + 2, + ], + ); + assertEquals( + stringify(withEvenNumberOfEls), + `Float64Array(12) [ + 2.1, 2.01, + 2.001, 2.0001, + 2.00001, 2.000001, + 2.0000001, 2.00000001, + 2.000000001, 2.0000000001, + 2, 2 +]`, + ); + const withThreeColumns = [ + 2, + 2.1, + 2.11, + 2, + 2.111, + 2.1111, + 2, + 2.1, + 2.11, + 2, + 2.1, + ]; + assertEquals( + stringify(withThreeColumns), + `[ + 2, 2.1, 2.11, + 2, 2.111, 2.1111, + 2, 2.1, 2.11, + 2, 2.1 +]`, + ); +}); + unitTest(async function consoleTestStringifyPromises(): Promise<void> { const pendingPromise = new Promise((_res, _rej) => {}); assertEquals(stringify(pendingPromise), "Promise { <pending> }"); |