2023-01-13 02:51:32 -05:00
|
|
|
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
|
|
|
|
2022-07-20 04:12:18 -04:00
|
|
|
import {
|
|
|
|
assertEquals,
|
|
|
|
assertNotEquals,
|
|
|
|
assertStringIncludes,
|
|
|
|
} from "./test_util.ts";
|
2021-07-08 09:43:36 -04:00
|
|
|
|
2021-11-23 11:45:18 -05:00
|
|
|
Deno.test(function customInspectFunction() {
|
2021-07-08 09:43:36 -04:00
|
|
|
const blob = new DOMException("test");
|
|
|
|
assertEquals(
|
|
|
|
Deno.inspect(blob),
|
|
|
|
`DOMException: test`,
|
|
|
|
);
|
|
|
|
assertStringIncludes(Deno.inspect(DOMException.prototype), "DOMException");
|
|
|
|
});
|
2022-07-20 04:12:18 -04:00
|
|
|
|
|
|
|
Deno.test(function nameToCodeMappingPrototypeAccess() {
|
|
|
|
const newCode = 100;
|
|
|
|
const objectPrototype = Object.prototype as unknown as {
|
|
|
|
pollution: number;
|
|
|
|
};
|
|
|
|
objectPrototype.pollution = newCode;
|
|
|
|
assertNotEquals(newCode, new DOMException("test", "pollution").code);
|
|
|
|
Reflect.deleteProperty(objectPrototype, "pollution");
|
|
|
|
});
|