about summary refs log tree commit diff
path: root/tests/ui/cfg/true-false.rs
blob: 0bd1cf427fafd8d2e8abd1de059d9796ea47f953 (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
//@ run-pass

#![feature(link_cfg)]

#[cfg(true)]
fn foo() -> bool {
    cfg!(true)
}

#[cfg(false)]
fn foo() -> bool {
    cfg!(false)
}

#[cfg_attr(true, cfg(false))]
fn foo() {}

#[link(name = "foo", cfg(false))]
extern "C" {}

fn main() {
    assert!(foo());
    assert!(cfg!(true));
    assert!(!cfg!(false));
    assert!(cfg!(not(false)));
    assert!(cfg!(all(true)));
    assert!(cfg!(any(true)));
    assert!(!cfg!(not(true)));
}