Debian Codegraph @

third_party/rust/tokio/tests/macros_rename_test.rs

raw
1 #![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi doesn't support threading
2
3 #[allow(unused_imports)]
4 use std as tokio;
5
6 use ::tokio as tokio1;
7
8 mod test {
9 pub use ::tokio;
10 }
11
12 async fn compute() -> usize {
13 let join = tokio1::spawn(async { 1 });
14 join.await.unwrap()
15 }
16
17 #[tokio1::main(crate = "tokio1")]
18 async fn compute_main() -> usize {
19 compute().await
20 }
21
22 #[test]
23 fn crate_rename_main() {
24 assert_eq!(1, compute_main());
25 }
26
27 #[tokio1::test(crate = "tokio1")]
28 async fn crate_rename_test() {
29 assert_eq!(1, compute().await);
30 }
31
32 #[test::tokio::test(crate = "test::tokio")]
33 async fn crate_path_test() {
34 assert_eq!(1, compute().await);
35 }