refactor(core): validate promise id in refOp (#13905)

This commit is contained in:
Yoshiya Hinosawa 2022-03-12 01:18:49 +09:00 committed by GitHub
parent f9b4d262b3
commit b198bfd795
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 59 additions and 20 deletions

View file

@ -0,0 +1,10 @@
import { assertNotEquals, execCode } from "./test_util.ts";
Deno.test("[unrefOp] unref'ing invalid ops does not have effects", async () => {
const [statusCode, _] = await execCode(`
Deno.core.unrefOp(-1);
setTimeout(() => { throw new Error() }, 10)
`);
// Invalid unrefOp call doesn't affect exit condition of event loop
assertNotEquals(statusCode, 0);
});