summaryrefslogtreecommitdiffstats
path: root/tests-build/tests/features.rs
blob: b40e44ed6ea8a88ad56dd361c3e3a34da4802e6c (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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#![allow(unused_imports)]

#[test]
#[cfg(feature = "tokio-net")]
fn net_default() {
    use tests_build::tokio_net::driver::{set_default, Handle, Reactor, Registration};
    use tests_build::tokio_net::util::PollEvented;
}

#[test]
#[cfg(feature = "net-with-tcp")]
fn net_with_tcp() {
    use tests_build::tokio_net::tcp;
}

#[test]
#[cfg(feature = "net-with-udp")]
fn net_with_udp() {
    use tests_build::tokio_net::udp;
}

#[test]
#[cfg(feature = "net-with-uds")]
fn net_with_uds() {
    use tests_build::tokio_net::uds;
}

#[test]
#[cfg(feature = "net-with-process")]
fn net_with_process() {
    use tests_build::tokio_net::process;
}

#[test]
#[cfg(feature = "tokio-with-net")]
fn tokio_with_net() {
    // net is present
    use tests_build::tokio::net;
}

#[test]
fn compile_fail() {
    let t = trybuild::TestCases::new();

    #[cfg(feature = "executor-without-current-thread")]
    t.compile_fail("tests/fail/executor_without_current_thread.rs");

    #[cfg(feature = "macros-invalid-input")]
    t.compile_fail("tests/fail/macros_invalid_input.rs");

    #[cfg(feature = "net-no-features")]
    {
        t.compile_fail("tests/fail/net_without_tcp_missing_tcp.rs");
        t.compile_fail("tests/fail/net_without_udp_missing_udp.rs");
        t.compile_fail("tests/fail/net_without_uds_missing_uds.rs");
    }

    #[cfg(feature = "tokio-no-features")]
    t.compile_fail("tests/fail/tokio_without_net_missing_net.rs");

    drop(t);
}