1
0
dust/tests/block.rs

33 lines
570 B
Rust
Raw Permalink Normal View History

2024-01-06 07:26:51 +00:00
use dust_lang::*;
#[test]
fn simple() {
assert_eq!(interpret("{ 1 }"), Ok(Value::Integer(1)));
}
#[test]
fn nested() {
assert_eq!(interpret("{ 1 { 1 + 1 } }"), Ok(Value::Integer(2)));
}
#[test]
fn with_return() {
assert_eq!(interpret("{ return 1; 1 + 1; }"), Ok(Value::Integer(1)));
}
#[test]
fn async_with_return() {
assert_eq!(
interpret(
"
async {
return 1
1 + 1
3
}
"
),
Ok(Value::Integer(1))
);
}