Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: test unexpected panic [DO NOT MERGE] #3739

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions test_programs/execution_success/unexpected_panic/Nargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[package]
name = "unexpected_panic"
version = "0.1.0"
type = "bin"
authors = [""]

[dependencies]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
y = "4"
17 changes: 17 additions & 0 deletions test_programs/execution_success/unexpected_panic/src/main.nr
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
struct Bar {
inner: [Field; 3],
}

fn main(y: pub u32) {
let bar = Bar { inner: [100, 101, 102] };

// The assert inside the if should be hit
if y < 10 {
assert(bar.inner == [100, 101, 102]);
}

// The assert inside the if should not be hit
if y > 10 {
assert(bar.inner == [0, 1, 2]);
}
}
Loading