1
0

Rewrite test

This commit is contained in:
Jeff 2023-08-22 13:00:34 -04:00
parent f6b1cd530a
commit f15c8ef2ef

View File

@ -17,12 +17,23 @@ fn r#if() {
eval("if(true, assert(true))").unwrap(); eval("if(true, assert(true))").unwrap();
let value = eval("if(true, 1)").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()); assert!(value.is_empty());
} }
#[test] #[test]
fn r#if_else() { fn r#if_else() {
eval("if(true, assert(true), assert(false))").unwrap(); let value = eval("if(true, 1, 2)").unwrap();
eval("if(false, assert(false), assert(true))").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);
} }