constant test

This commit is contained in:
Devyn Cairns 2024-07-01 14:12:32 -07:00
parent 4af1b1981d
commit 37a3b19cc5
No known key found for this signature in database

View File

@ -250,6 +250,19 @@ fn let_variable_mutate_error() {
)
}
#[test]
fn constant() {
test_eval("const foo = 1 + 2; print $foo", Eq("3"))
}
#[test]
fn constant_assign_error() {
test_eval(
"const foo = 1 + 2; $foo = 4; print $foo",
Error("immutable"),
)
}
#[test]
fn mut_variable() {
test_eval("mut foo = 'test'; $foo = 'bar'; print $foo", Eq("bar"))