mirror of
https://github.com/denoland/deno.git
synced 2025-01-10 16:11:13 -05:00
chore: remove dead code (#10321)
This commit is contained in:
parent
2b5cc6b498
commit
1f821dd5e5
1 changed files with 0 additions and 76 deletions
|
@ -1612,82 +1612,6 @@ pub mod tests {
|
||||||
assert_eq!(dispatch_count.load(Ordering::Relaxed), 1);
|
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]
|
#[test]
|
||||||
fn terminate_execution() {
|
fn terminate_execution() {
|
||||||
let (mut isolate, _dispatch_count) = setup(Mode::Async);
|
let (mut isolate, _dispatch_count) = setup(Mode::Async);
|
||||||
|
|
Loading…
Reference in a new issue