fix: lazy select_with_default
This commit is contained in:
@@ -99,3 +99,21 @@ fn logical_not() {
|
||||
assert_eq!(eval("!true"), Value::Bool(false));
|
||||
assert_eq!(eval("!false"), Value::Bool(true));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn select_with_default_lazy_evaluation() {
|
||||
assert_eq!(eval("{ a = 1; }.a or (1 / 0)"), Value::Int(1));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn select_with_default_nested_lazy() {
|
||||
assert_eq!(
|
||||
eval("{ a.b = 42; }.a.b or (builtins.abort \"should not evaluate\")"),
|
||||
Value::Int(42)
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn select_with_default_fallback() {
|
||||
assert_eq!(eval("{ a = 1; }.b or 999"), Value::Int(999));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user