diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2021-07-08 09:43:36 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-08 09:43:36 -0400 |
commit | 5fa58c92165e23386b8ed3c3079103997fe1bef9 (patch) | |
tree | d7efc34a11322d10f2749b5083cd84fa1b4a18d6 /cli/tests/unit/performance_test.ts | |
parent | 5e092b19fe113bdecd36b4e0184c82f4b3343bca (diff) |
fix: inspecting prototypes of built-ins with custom inspect implementations should not throw (#11308)
Diffstat (limited to 'cli/tests/unit/performance_test.ts')
-rw-r--r-- | cli/tests/unit/performance_test.ts | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/cli/tests/unit/performance_test.ts b/cli/tests/unit/performance_test.ts index 156841165..94af0731c 100644 --- a/cli/tests/unit/performance_test.ts +++ b/cli/tests/unit/performance_test.ts @@ -2,6 +2,7 @@ import { assert, assertEquals, + assertStringIncludes, assertThrows, deferred, unitTest, @@ -81,6 +82,32 @@ unitTest(function performanceMeasure() { }); }); +unitTest(function performanceCustomInspectFunction(): void { + assertStringIncludes(Deno.inspect(performance), "Performance"); + assertStringIncludes( + Deno.inspect(Performance.prototype), + "Performance", + ); +}); + +unitTest(function performanceMarkCustomInspectFunction(): void { + const mark1 = performance.mark("mark1"); + assertStringIncludes(Deno.inspect(mark1), "PerformanceMark"); + assertStringIncludes( + Deno.inspect(PerformanceMark.prototype), + "PerformanceMark", + ); +}); + +unitTest(function performanceMeasureCustomInspectFunction(): void { + const measure1 = performance.measure("measure1"); + assertStringIncludes(Deno.inspect(measure1), "PerformanceMeasure"); + assertStringIncludes( + Deno.inspect(PerformanceMeasure.prototype), + "PerformanceMeasure", + ); +}); + unitTest(function performanceIllegalConstructor() { assertThrows(() => new Performance(), TypeError, "Illegal constructor"); assertEquals(Performance.length, 0); |