1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-22 23:34:47 -05:00

chore: remove dead code (#10321)

This commit is contained in:
Ryan Dahl 2021-04-22 20:39:02 -04:00 committed by GitHub
parent 2b5cc6b498
commit 1f821dd5e5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1612,82 +1612,6 @@ pub mod tests {
assert_eq!(dispatch_count.load(Ordering::Relaxed), 1);
}
#[test]
#[ignore] // TODO(ry) re-enable? setAsyncHandler has been removed
fn test_poll_async_delayed_ops() {
run_in_task(|cx| {
let (mut runtime, dispatch_count) = setup(Mode::Async);
runtime
.execute(
"setup2.js",
r#"
let nrecv = 0;
Deno.core.setAsyncHandler(1, (buf) => {
nrecv++;
});
"#,
)
.unwrap();
assert_eq!(dispatch_count.load(Ordering::Relaxed), 0);
runtime
.execute(
"check1.js",
r#"
assert(nrecv == 0);
let control = 42;
Deno.core.send(1, null, control);
assert(nrecv == 0);
"#,
)
.unwrap();
assert_eq!(dispatch_count.load(Ordering::Relaxed), 1);
assert!(matches!(runtime.poll_event_loop(cx), Poll::Ready(Ok(_))));
assert_eq!(dispatch_count.load(Ordering::Relaxed), 1);
runtime
.execute(
"check2.js",
r#"
assert(nrecv == 1);
Deno.core.send(1, null, control);
assert(nrecv == 1);
"#,
)
.unwrap();
assert_eq!(dispatch_count.load(Ordering::Relaxed), 2);
assert!(matches!(runtime.poll_event_loop(cx), Poll::Ready(Ok(_))));
runtime.execute("check3.js", "assert(nrecv == 2)").unwrap();
assert_eq!(dispatch_count.load(Ordering::Relaxed), 2);
// We are idle, so the next poll should be the last.
assert!(matches!(runtime.poll_event_loop(cx), Poll::Ready(Ok(_))));
});
}
#[test]
#[ignore] // TODO(ry) re-enable? setAsyncHandler has been removed
fn test_poll_async_optional_ops() {
run_in_task(|cx| {
let (mut runtime, dispatch_count) = setup(Mode::AsyncUnref);
runtime
.execute(
"check1.js",
r#"
Deno.core.setAsyncHandler(1, (buf) => {
// This handler will never be called
assert(false);
});
let control = 42;
Deno.core.send(1, null, control);
"#,
)
.unwrap();
assert_eq!(dispatch_count.load(Ordering::Relaxed), 1);
// The above op never finish, but runtime can finish
// because the op is an unreffed async op.
assert!(matches!(runtime.poll_event_loop(cx), Poll::Ready(Ok(_))));
})
}
#[test]
fn terminate_execution() {
let (mut isolate, _dispatch_count) = setup(Mode::Async);