constant test
This commit is contained in:
parent
4af1b1981d
commit
37a3b19cc5
|
@ -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]
|
#[test]
|
||||||
fn mut_variable() {
|
fn mut_variable() {
|
||||||
test_eval("mut foo = 'test'; $foo = 'bar'; print $foo", Eq("bar"))
|
test_eval("mut foo = 'test'; $foo = 'bar'; print $foo", Eq("bar"))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user