Merge branch 'main' into gui

This commit is contained in:
Jeff 2023-12-31 08:40:31 -05:00
commit 9323548375

View File

@ -47,6 +47,50 @@ mod assignment {
} }
} }
mod for_loop {
use dust_lang::*;
#[test]
fn simple_for_loop() {
let result = interpret("for i in [1 2 3] { output(i) }");
assert_eq!(Ok(Value::none()), result);
}
#[test]
fn modify_value() {
let result = interpret(
"
list = []
for i in [1 2 3] { list += i }
list
",
);
assert_eq!(
Ok(Value::List(List::with_items(vec![
Value::Integer(1),
Value::Integer(2),
Value::Integer(3),
]))),
result
);
}
#[test]
fn modify_value_async() {
let result = interpret(
"
list = []
async for i in [1 2 3] { list += i }
length(list)
",
);
assert_eq!(Ok(Value::Integer(3)), result);
}
}
mod logic { mod logic {
use dust_lang::*; use dust_lang::*;