mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 20:31:13 +00:00
@@ -66,6 +66,9 @@ pub use runtime_io::print;
|
||||
#[doc(inline)]
|
||||
pub use srml_support_procedural::decl_storage;
|
||||
|
||||
/// Return Err of the expression: `return Err($expression);`.
|
||||
///
|
||||
/// Used as `fail!(expression)`.
|
||||
#[macro_export]
|
||||
macro_rules! fail {
|
||||
( $y:expr ) => {{
|
||||
@@ -73,6 +76,9 @@ macro_rules! fail {
|
||||
}}
|
||||
}
|
||||
|
||||
/// Evaluate `$x:expr` and if not true return `Err($y:expr)`.
|
||||
///
|
||||
/// Used as `ensure!(expression_to_ensure, expression_to_return_on_false)`.
|
||||
#[macro_export]
|
||||
macro_rules! ensure {
|
||||
( $x:expr, $y:expr ) => {{
|
||||
@@ -82,6 +88,10 @@ macro_rules! ensure {
|
||||
}}
|
||||
}
|
||||
|
||||
/// Evaluate an expression, assert it returns an expected `Err` value and that
|
||||
/// runtime storage has not been mutated (i.e. expression is a no-operation).
|
||||
///
|
||||
/// Used as `assert_noop(expression_to_assert, expected_error_expression)`.
|
||||
#[macro_export]
|
||||
#[cfg(feature = "std")]
|
||||
macro_rules! assert_noop {
|
||||
@@ -92,6 +102,13 @@ macro_rules! assert_noop {
|
||||
}
|
||||
}
|
||||
|
||||
/// Panic if an expression doesn't evaluate to an `Err`.
|
||||
///
|
||||
/// Used as `assert_err!(expression_to_assert, expected_err_expression)`.
|
||||
|
||||
/// Assert an expression returns an error specified.
|
||||
///
|
||||
/// Used as `assert_err!(expression_to_assert, expected_error_expression)`
|
||||
#[macro_export]
|
||||
#[cfg(feature = "std")]
|
||||
macro_rules! assert_err {
|
||||
@@ -100,6 +117,10 @@ macro_rules! assert_err {
|
||||
}
|
||||
}
|
||||
|
||||
/// Panic if an expression doesn't evaluate to `Ok`.
|
||||
///
|
||||
/// Used as `assert_ok!(expression_to_assert, expected_ok_expression)`,
|
||||
/// or `assert_ok!(expression_to_assert)` which would assert against `Ok(())`.
|
||||
#[macro_export]
|
||||
#[cfg(feature = "std")]
|
||||
macro_rules! assert_ok {
|
||||
|
||||
Reference in New Issue
Block a user