]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/assertions_on_constants.rs
Add tests for assertion_on_constants macro check
[rust.git] / tests / ui / assertions_on_constants.rs
index daeceebd3a2c7ed3fb76e08b2f1e6734e80829e0..0d2953c7ed8143ccdf1afef0a2057153923d3561 100644 (file)
@@ -1,3 +1,10 @@
+macro_rules! assert_const {
+    ($len:expr) => {
+        assert!($len > 0);
+        debug_assert!($len < 0);
+    };
+}
+
 fn main() {
     assert!(true);
     assert!(false);
@@ -9,4 +16,8 @@ fn main() {
 
     const C: bool = false;
     assert!(C);
+
+    debug_assert!(true);
+    assert_const!(3);
+    assert_const!(-1);
 }