]> git.lizzy.rs Git - rust.git/blob - tests/ui/assertions_on_constants.rs
Add tests for assertion_on_constants macro check
[rust.git] / tests / ui / assertions_on_constants.rs
1 macro_rules! assert_const {
2     ($len:expr) => {
3         assert!($len > 0);
4         debug_assert!($len < 0);
5     };
6 }
7
8 fn main() {
9     assert!(true);
10     assert!(false);
11     assert!(true, "true message");
12     assert!(false, "false message");
13
14     const B: bool = true;
15     assert!(B);
16
17     const C: bool = false;
18     assert!(C);
19
20     debug_assert!(true);
21     assert_const!(3);
22     assert_const!(-1);
23 }