Skip to content

Commit

Permalink
test: add test for missing lambda closure environment (#2120)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeljklein committed Jan 30, 2024
1 parent 9fb6b09 commit 22256ef
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[package]
name = "missing_closure_env"
type = "bin"
authors = [""]
compiler_version = ">=0.23.0"

[dependencies]
15 changes: 15 additions & 0 deletions test_programs/execution_success/missing_closure_env/src/main.nr
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
fn main() {
let x1 = &mut 42;
let set_x1 = |y| { *x1 = y; };

assert(*x1 == 42);
set_x1(44);
assert(*x1 == 44);
set_x1(*x1);
assert(*x1 == 44);
}

#[test]
fn test_main() {
main();
}

0 comments on commit 22256ef

Please sign in to comment.