From 698f8c2f01ea549d77d7dc3338a12e04c11057b9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:02:58 +0200 Subject: Adding upstream version 1.64.0+dfsg1. Signed-off-by: Daniel Baumann --- vendor/always-assert/tests/it.rs | 79 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 vendor/always-assert/tests/it.rs (limited to 'vendor/always-assert/tests/it.rs') diff --git a/vendor/always-assert/tests/it.rs b/vendor/always-assert/tests/it.rs new file mode 100644 index 000000000..18855787d --- /dev/null +++ b/vendor/always-assert/tests/it.rs @@ -0,0 +1,79 @@ +#[cfg(any(debug_assertions, feature = "force"))] +mod armed { + use always_assert::{always, never}; + + #[test] + #[should_panic = "assertion failed: 2 + 2 == 5"] + fn syntax1() { + let _: bool = always!(2 + 2 == 5); + } + + #[test] + #[should_panic = "custom"] + fn syntax2() { + let _: bool = always!(2 + 2 == 5, "custom"); + } + + #[test] + #[should_panic = "custom 92"] + fn syntax3() { + let _: bool = always!(2 + 2 == 5, "custom {}", 92); + } + + #[test] + #[should_panic = "assertion failed: !(2 + 2 == 4)"] + fn syntax4() { + let _: bool = never!(2 + 2 == 4); + } + + #[test] + #[should_panic = "custom"] + fn syntax5() { + let _: bool = never!(2 + 2 == 4, "custom"); + } + + #[test] + #[should_panic = "custom 92"] + fn syntax6() { + let _: bool = never!(2 + 2 == 4, "custom {}", 92); + } + + #[test] + #[should_panic = "unreachable code"] + fn syntax7() { + let () = never!(); + } + + #[test] + #[should_panic = "custom"] + fn syntax8() { + let () = never!("custom"); + } + + #[test] + #[should_panic = "custom"] + fn syntax9() { + let () = never!("custom"); + } + + #[test] + #[should_panic = "custom 92"] + fn syntax10() { + let () = never!("custom {}", 92); + } +} + +#[cfg(all(not(debug_assertions), not(feature = "force")))] +mod disarmed { + use always_assert::{always, never}; + + #[test] + fn syntax1() { + assert!(!always!(false)); + } + + #[test] + fn syntax2() { + assert!(never!(true)); + } +} -- cgit v1.2.3