From 49541a04d25ba7308759824213b6053a7b412e3e Mon Sep 17 00:00:00 2001 From: "Kevin (Kun) \"Kassimo\" Qian" Date: Mon, 16 Mar 2020 06:05:39 -0700 Subject: console: Symbol.toStringTag and display Object symbol entries (#4388) --- cli/js/tests/console_test.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'cli/js/tests/console_test.ts') diff --git a/cli/js/tests/console_test.ts b/cli/js/tests/console_test.ts index 256c7da80..b64016078 100644 --- a/cli/js/tests/console_test.ts +++ b/cli/js/tests/console_test.ts @@ -163,10 +163,14 @@ unitTest(function consoleTestStringifyCircular(): void { "{ a: { b: { c: { d: [Set] } } } }" ); assertEquals(stringify(nestedObj), nestedObjExpected); - assertEquals(stringify(JSON), "{}"); + assertEquals(stringify(JSON), 'JSON { Symbol(Symbol.toStringTag): "JSON" }'); assertEquals( stringify(console), - "{ printFunc, log, debug, info, dir, dirxml, warn, error, assert, count, countReset, table, time, timeLog, timeEnd, group, groupCollapsed, groupEnd, clear, trace, indentLevel }" + "{ printFunc, log, debug, info, dir, dirxml, warn, error, assert, count, countReset, table, time, timeLog, timeEnd, group, groupCollapsed, groupEnd, clear, trace, indentLevel, Symbol(isConsoleInstance) }" + ); + assertEquals( + stringify({ str: 1, [Symbol.for("sym")]: 2, [Symbol.toStringTag]: "TAG" }), + 'TAG { str: 1, Symbol(sym): 2, Symbol(Symbol.toStringTag): "TAG" }' ); // test inspect is working the same assertEquals(inspect(nestedObj), nestedObjExpected); @@ -224,7 +228,10 @@ unitTest(function consoleTestWithCustomInspectorError(): void { } assertEquals(stringify(new B({ a: "a" })), "a"); - assertEquals(stringify(B.prototype), "{}"); + assertEquals( + stringify(B.prototype), + "{ Symbol(Deno.customInspect): [Function: [Deno.customInspect]] }" + ); }); unitTest(function consoleTestWithIntegerFormatSpecifier(): void { -- cgit v1.2.3