From f15c8ef2ef3c3b030a71ba855f7a2f65d283eb45 Mon Sep 17 00:00:00 2001 From: Jeff Date: Tue, 22 Aug 2023 13:00:34 -0400 Subject: [PATCH] Rewrite test --- tests/logic.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/tests/logic.rs b/tests/logic.rs index 6eef79c..1a971fb 100644 --- a/tests/logic.rs +++ b/tests/logic.rs @@ -17,12 +17,23 @@ fn r#if() { eval("if(true, assert(true))").unwrap(); let value = eval("if(true, 1)").unwrap(); + assert_eq!(Value::Integer(1), value); + let value = eval("if(false, 1)").unwrap(); assert!(value.is_empty()); } #[test] fn r#if_else() { - eval("if(true, assert(true), assert(false))").unwrap(); - eval("if(false, assert(false), assert(true))").unwrap(); + let value = eval("if(true, 1, 2)").unwrap(); + assert_eq!(Value::Integer(1), value); + + let value = eval("if(false, 1, 2)").unwrap(); + assert_eq!(Value::Integer(2), value); + + let value = eval("if(true, '1', '2')").unwrap(); + assert_eq!(Value::Integer(1), value); + + let value = eval("if(false, '1', '2')").unwrap(); + assert_eq!(Value::Integer(2), value); }