diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2019-03-19 13:52:25 -0400 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2019-03-20 12:38:59 -0400 |
commit | 842627d6b905f71aea821c426a886022b07270a5 (patch) | |
tree | 0a1252d36391b7bcedcf5fb451bbf956be527bc3 /js/console_test.ts | |
parent | 8f334ae56887cc5291be20da8b9288fe7054410e (diff) |
pretty-print long strings
Diffstat (limited to 'js/console_test.ts')
-rw-r--r-- | js/console_test.ts | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/js/console_test.ts b/js/console_test.ts index 994f0ecfd..b20a60197 100644 --- a/js/console_test.ts +++ b/js/console_test.ts @@ -31,6 +31,17 @@ test(function consoleTestStringifyComplexObjects() { assertEquals(stringify({ foo: "bar" }), `{ foo: "bar" }`); }); +test(function consoleTestStringifyLongStrings() { + const veryLongString = "a".repeat(200); + // If we stringify an object containing the long string, it gets abbreviated. + let actual = stringify({ veryLongString }); + assert(actual.includes("...")); + assert(actual.length < 200); + // However if we stringify the string itself, we get it exactly. + actual = stringify(veryLongString); + assertEquals(actual, veryLongString); +}); + test(function consoleTestStringifyCircular() { class Base { a = 1; |