Rewrite test
This commit is contained in:
parent
f6b1cd530a
commit
f15c8ef2ef
@ -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);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user