diff options
author | Yoshiya Hinosawa <stibium121@gmail.com> | 2021-06-25 16:19:18 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-25 16:19:18 +0900 |
commit | d832d2bfd1f0487181f96bdecd7a28968a150fac (patch) | |
tree | b4e40fa8689bf97434470cfce9f303f8ddeacf9a /cli/tests/unit/console_test.ts | |
parent | 606611708c4351e9f5e0e3b975f9331d95168efb (diff) |
chore(ext/console): deprecate Deno.customInspect (#10035)
Co-authored-by: Bartek IwaĆczuk <biwanczuk@gmail.com>
Diffstat (limited to 'cli/tests/unit/console_test.ts')
-rw-r--r-- | cli/tests/unit/console_test.ts | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/cli/tests/unit/console_test.ts b/cli/tests/unit/console_test.ts index 8013da152..edb1b245f 100644 --- a/cli/tests/unit/console_test.ts +++ b/cli/tests/unit/console_test.ts @@ -17,7 +17,7 @@ import { } from "./test_util.ts"; import { stripColor } from "../../../test_util/std/fmt/colors.ts"; -const customInspect = Deno.customInspect; +const customInspect = Symbol.for("Deno.customInspect"); const { Console, cssToAnsi: cssToAnsi_, @@ -879,6 +879,18 @@ unitTest(function consoleTestWithCustomInspector(): void { assertEquals(stringify(new A()), "b"); }); +unitTest(function consoleTestWithCustomInspectorUsingInspectFunc(): void { + class A { + [customInspect]( + inspect: (v: unknown, opts?: Deno.InspectOptions) => string, + ): string { + return "b " + inspect({ c: 1 }); + } + } + + assertEquals(stringify(new A()), "b { c: 1 }"); +}); + unitTest(function consoleTestWithCustomInspectorError(): void { class A { [customInspect](): never { |