1
0
dust/tests/match.rs

35 lines
615 B
Rust
Raw Permalink Normal View History

2024-01-06 07:26:51 +00:00
use dust_lang::*;
#[test]
fn r#match() {
let test = interpret(
"
match 1 {
3 => false
2 => { false }
1 => true
}
",
)
.unwrap();
assert_eq!(Value::Boolean(true), test);
}
#[test]
fn match_assignment() {
let test = interpret(
"
x = match 1 {
3 => false
2 => { false }
1 => true
}
x
",
)
.unwrap();
assert_eq!(Value::Boolean(true), test);
}