summaryrefslogtreecommitdiffstats
path: root/tests-integration/tests/macros_main.rs
blob: 42f5be3bde02386f0353b63e2b3c4cfa03f948bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#![cfg(feature = "macros")]

#[tokio::main]
async fn basic_main() -> usize {
    1
}

#[tokio::main]
async fn generic_fun<T: Default>() -> T {
    T::default()
}

#[cfg(feature = "rt-core")]
mod spawn {
    #[tokio::main]
    async fn spawning() -> usize {
        let join = tokio::spawn(async { 1 });
        join.await.unwrap()
    }

    #[test]
    fn main_with_spawn() {
        assert_eq!(1, spawning());
    }
}

#[test]
fn shell() {
    assert_eq!(1, basic_main());
    assert_eq!(bool::default(), generic_fun::<bool>())
}