Debian Codegraph @

third_party/rust/maybe-async/tests/unit-test-util.rs

raw
1 use maybe_async::maybe_async;
2
3 #[maybe_async]
4 async fn async_fn() -> bool {
5 true
6 }
7
8 #[maybe_async::test(feature = "is_sync", async(not(feature = "is_sync"), async_std::test))]
9 async fn test_async_fn() {
10 let res = async_fn().await;
11 assert_eq!(res, true);
12 }
13
14 #[maybe_async::test(feature = "is_sync", async(not(feature = "is_sync"), tokio::test))]
15 async fn test_async_fn2() {
16 let res = async_fn().await;
17 assert_eq!(res, true);
18 }
19
20 #[maybe_async::test(feature = "is_sync")]
21 async fn test_async_fn3() {
22 let res = async_fn().await;
23 assert_eq!(res, true);
24 }
25
26 #[maybe_async::test(feature = "is_sync")]
27 async fn test_sync_fn() {
28 let res = async_fn();
29 assert_eq!(res, true);
30 }