summaryrefslogtreecommitdiff
path: root/cli/js/tests/console_test.ts
diff options
context:
space:
mode:
authorKevin (Kun) "Kassimo" Qian <kevinkassimo@gmail.com>2020-03-16 06:05:39 -0700
committerGitHub <noreply@github.com>2020-03-16 09:05:39 -0400
commit49541a04d25ba7308759824213b6053a7b412e3e (patch)
treed10b03759aa704d76818228cc0fe154272622eaf /cli/js/tests/console_test.ts
parent62942749e6982b9aee24c22a5abdbc44b7f0e6b6 (diff)
console: Symbol.toStringTag and display Object symbol entries (#4388)
Diffstat (limited to 'cli/js/tests/console_test.ts')
-rw-r--r--cli/js/tests/console_test.ts13
1 files changed, 10 insertions, 3 deletions
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 {