Skip to content
Merged
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
20 changes: 20 additions & 0 deletions crates/sui-prover/tests/inputs/assert.ok.move
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
module 0x42::foo {
public fun foo(input: u64): u64 {
assert!(input != 10);

input
}
}

module 0x43::bar {
use prover::prover::asserts;
use 0x42::foo::foo;

#[spec(prove, target = 0x42::foo::foo)]
fun foo_spec(input: u64): u64 {
asserts(input != 10);

let result = foo(input);
result
}
Comment thread
andreistefanescu marked this conversation as resolved.
}
19 changes: 19 additions & 0 deletions crates/sui-prover/tests/inputs/assert.scenario.fail.move
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module 0x42::foo {
public fun foo(input: u64): u64 {
assert!(input != 10);

input
}
}

module 0x43::bar {
use prover::prover::asserts;
use 0x42::foo::foo;

#[spec(prove)]
fun scenario_spec(input: u64): u64 {
asserts(input != 10); // asserts are supported in scenario specs
let result = foo(input);
result
}
}
5 changes: 5 additions & 0 deletions crates/sui-prover/tests/snapshots/assert.ok.move.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
source: crates/sui-prover/tests/integration.rs
expression: output
---
Verification successful
15 changes: 15 additions & 0 deletions crates/sui-prover/tests/snapshots/assert.scenario.fail.move.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
source: crates/sui-prover/tests/integration.rs
assertion_line: 277
expression: output
---
exiting with bytecode transformation errors
error: Scenario specs either ignore aborts or do not have any asserts.
┌─ tests/inputs/assert.scenario.fail.move:14:5
14 │ ╭ fun scenario_spec(input: u64): u64 {
15 │ │ asserts(input != 10); // asserts are supported in scenario specs
16 │ │ let result = foo(input);
17 │ │ result
18 │ │ }
│ ╰─────^
Loading