Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
jfecher committed Jul 15, 2024
1 parent b171a80 commit bb01143
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions compiler/noirc_frontend/src/hir/comptime/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,18 @@ fn mutating_mutable_references() {
assert_eq!(result, Value::I64(4));
}

#[test]
fn mutation_leaks() {
let program = "comptime fn main() -> pub i8 {
let mut x = 3;
let y = &mut x;
*y = 5;
x
}";
let result = interpret(program, vec!["main".into()]);
assert_eq!(result, Value::I8(5));
}

#[test]
fn mutating_arrays() {
let program = "comptime fn main() -> pub u8 {
Expand Down

0 comments on commit bb01143

Please sign in to comment.