Skip to content

Commit ce479c6

Browse files
authored
Un-ignore some async tests now that they're fixed (#1290)
Fixed in bytecodealliance/wasip3-prototyping#148
1 parent 16ad298 commit ce479c6

File tree

2 files changed

+30
-41
lines changed

2 files changed

+30
-41
lines changed

tests/runtime-async/async/future-cancel-read/test.rs

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,13 @@ impl crate::exports::my::test::i::Guest for Component {
2828
}
2929

3030
async fn start_read_then_cancel() {
31-
// FIXME(wasip3-prototyping#137)
32-
if false {
33-
let (tx, rx) = wit_future::new::<u32>();
34-
let mut read = Box::pin(rx.into_future());
35-
assert!(read
36-
.as_mut()
37-
.poll(&mut Context::from_waker(noop_waker_ref()))
38-
.is_pending());
39-
drop(tx);
40-
assert!(read.as_mut().cancel().unwrap().is_none());
41-
}
31+
let (tx, rx) = wit_future::new::<u32>();
32+
let mut read = Box::pin(rx.into_future());
33+
assert!(read
34+
.as_mut()
35+
.poll(&mut Context::from_waker(noop_waker_ref()))
36+
.is_pending());
37+
drop(tx);
38+
assert!(read.as_mut().cancel().unwrap().is_none());
4239
}
4340
}

tests/runtime-async/async/future-cancel-write/runner.rs

Lines changed: 22 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -40,39 +40,31 @@ fn main() {
4040
};
4141

4242
// cancel after we hit the intrinsic and then close the other end
43-
//
44-
// FIXME(wasip3-prototyping#137)
45-
if false {
46-
let (tx, rx) = wit_future::new::<String>();
47-
let mut future = Box::pin(tx.write("hello3".into()));
48-
assert!(future
49-
.as_mut()
50-
.poll(&mut Context::from_waker(noop_waker_ref()))
51-
.is_pending());
52-
drop(rx);
53-
match future.as_mut().cancel() {
54-
FutureWriteCancel::Closed(val) => assert_eq!(val, "hello3"),
55-
other => panic!("expected closed, got: {other:?}"),
56-
};
57-
}
43+
let (tx, rx) = wit_future::new::<String>();
44+
let mut future = Box::pin(tx.write("hello3".into()));
45+
assert!(future
46+
.as_mut()
47+
.poll(&mut Context::from_waker(noop_waker_ref()))
48+
.is_pending());
49+
drop(rx);
50+
match future.as_mut().cancel() {
51+
FutureWriteCancel::Closed(val) => assert_eq!(val, "hello3"),
52+
other => panic!("expected closed, got: {other:?}"),
53+
};
5854

5955
// Start a write, wait for it to be pending, then go complete the write
6056
// in some async work, then cancel it and witness that it was written,
6157
// not cancelled.
62-
//
63-
// FIXME(wasip3-prototyping#138)
64-
if false {
65-
let (tx, rx) = wit_future::new::<String>();
66-
let mut future = Box::pin(tx.write("hello3".into()));
67-
assert!(future
68-
.as_mut()
69-
.poll(&mut Context::from_waker(noop_waker_ref()))
70-
.is_pending());
71-
read_and_drop(rx).await;
72-
match future.as_mut().cancel() {
73-
FutureWriteCancel::AlreadySent => {}
74-
other => panic!("expected sent, got: {other:?}"),
75-
};
76-
}
58+
let (tx, rx) = wit_future::new::<String>();
59+
let mut future = Box::pin(tx.write("hello3".into()));
60+
assert!(future
61+
.as_mut()
62+
.poll(&mut Context::from_waker(noop_waker_ref()))
63+
.is_pending());
64+
read_and_drop(rx).await;
65+
match future.as_mut().cancel() {
66+
FutureWriteCancel::AlreadySent => {}
67+
other => panic!("expected sent, got: {other:?}"),
68+
};
7769
});
7870
}

0 commit comments

Comments
 (0)