From d029def7c7b8a6c51832532aa4bf965489339770 Mon Sep 17 00:00:00 2001 From: jonesmarvin8 <83104039+jonesmarvin8@users.noreply.github.com> Date: Mon, 9 Mar 2026 12:21:44 -0400 Subject: [PATCH] add ensure test --- nssa/src/error.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/nssa/src/error.rs b/nssa/src/error.rs index 37177465..19f39c9f 100644 --- a/nssa/src/error.rs +++ b/nssa/src/error.rs @@ -67,3 +67,23 @@ pub enum NssaError { #[error("Chain of calls is too long")] MaxChainedCallsDepthExceeded, } + +#[derive(Debug)] +enum testError { + testErr, +} + + +fn test_function_ensure(cond: bool) -> Result<(), testError> { + ensure!(cond, testError::testErr); + + Ok(()) +} + + +#[test] +fn test_ensure() { + assert!(test_function_ensure(true).is_ok()); + assert!(test_function_ensure(false).is_err()); + +} \ No newline at end of file