mirror of
https://github.com/tursodatabase/limbo.git
synced 2025-07-07 20:45:01 +00:00

This adds a `turso_assert` macro that is Antithesis aware when `antithesis` feature flag is enabled. I did not yet convert any call-sites to use it. Co-authored-by: Nikita Sivukhin <sivukhin@turso.tech>
25 lines
834 B
Rust
25 lines
834 B
Rust
/// turso_assert! is a direct replacement for assert! builtin macros which under the hood
|
|
/// uses Antithesis SDK to guide Antithesis simulator if --features antithesis is enabled
|
|
#[cfg(not(feature = "antithesis"))]
|
|
#[macro_export]
|
|
macro_rules! turso_assert {
|
|
($cond:expr, $msg:literal, $($optional:tt)+) => {
|
|
assert!($cond, $msg, $($optional)+);
|
|
};
|
|
($cond:expr, $msg:literal) => {
|
|
assert!($cond, $msg);
|
|
};
|
|
}
|
|
|
|
#[cfg(feature = "antithesis")]
|
|
#[macro_export]
|
|
macro_rules! turso_assert {
|
|
($cond:expr, $msg:literal, $($optional:tt)+) => {
|
|
antithesis_sdk::assert_always_or_unreachable!($cond, $msg);
|
|
assert!($cond, $msg, $($optional)+);
|
|
};
|
|
($cond:expr, $msg:literal) => {
|
|
antithesis_sdk::assert_always_or_unreachable!($cond, $msg);
|
|
assert!($cond, $msg);
|
|
};
|
|
}
|