Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
bytecodealliance
GitHub Repository: bytecodealliance/wasmtime
Path: blob/main/crates/misc/component-async-tests/tests/scenario/yield_.rs
1693 views
1
use anyhow::Result;
2
3
use super::util::test_run;
4
5
// No-op function; we only test this by composing it in
6
// `async_yield_callee_synchronous` and `async_yield_callee_stackful`
7
#[allow(
8
dead_code,
9
reason = "here only to make the `assert_test_exists` macro happy"
10
)]
11
pub fn async_yield_caller() {}
12
13
// No-op function; we only test this by composing it in
14
// `async_yield_callee_synchronous` and `async_yield_callee_stackful`
15
#[allow(
16
dead_code,
17
reason = "here only to make the `assert_test_exists` macro happy"
18
)]
19
pub fn async_yield_caller_cancel() {}
20
21
#[tokio::test]
22
pub async fn async_yield_callee_synchronous() -> Result<()> {
23
test_run(&[
24
test_programs_artifacts::ASYNC_YIELD_CALLER_COMPONENT,
25
test_programs_artifacts::ASYNC_YIELD_CALLEE_SYNCHRONOUS_COMPONENT,
26
])
27
.await
28
}
29
30
#[tokio::test]
31
pub async fn async_yield_callee_stackless() -> Result<()> {
32
test_run(&[
33
test_programs_artifacts::ASYNC_YIELD_CALLER_COMPONENT,
34
test_programs_artifacts::ASYNC_YIELD_CALLEE_STACKLESS_COMPONENT,
35
])
36
.await
37
}
38
39
#[tokio::test]
40
pub async fn async_yield_callee_cancel_synchronous() -> Result<()> {
41
test_run(&[
42
test_programs_artifacts::ASYNC_YIELD_CALLER_CANCEL_COMPONENT,
43
test_programs_artifacts::ASYNC_YIELD_CALLEE_SYNCHRONOUS_COMPONENT,
44
])
45
.await
46
}
47
48
#[tokio::test]
49
pub async fn async_yield_callee_cancel_stackless() -> Result<()> {
50
test_run(&[
51
test_programs_artifacts::ASYNC_YIELD_CALLER_CANCEL_COMPONENT,
52
test_programs_artifacts::ASYNC_YIELD_CALLEE_STACKLESS_COMPONENT,
53
])
54
.await
55
}
56
57