Skip to content

Commit

Permalink
[verifier] Migrate id_immutable tests (MystenLabs#2015)
Browse files Browse the repository at this point in the history
- Migrated to expected output tests
  • Loading branch information
tnowacki authored May 17, 2022
1 parent 15c1dc3 commit 41c5506
Show file tree
Hide file tree
Showing 9 changed files with 91 additions and 158 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
processed 1 task

task 0 'publish'. lines 4-18:
Error: Failed to verify the Move module, reason: "In function foo: ID field of struct Foo cannot be mut borrowed because ID is immutable.".
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright (c) 2022, Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0

//# publish
module 0x0.M {
import 0x2.ID;

struct Foo<T> has key {
id: ID.VersionedID,
}

foo(f: Self.Foo<u64>) {
label l0:
_ = &mut (&mut f).Foo<u64>::id;
abort 0;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
processed 1 task

task 0 'publish'. lines 4-18:
Error: Failed to verify the Move module, reason: "In function foo: ID field of struct Foo cannot be mut borrowed because ID is immutable.".
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright (c) 2022, Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0

//# publish
module 0x0.M {
import 0x2.ID;

struct Foo has key {
id: ID.VersionedID,
}

foo(f: Self.Foo) {
label l0:
_ = &mut (&mut f).Foo::id;
abort 0;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
processed 1 task

task 0 'publish'. lines 4-19:
created: object(103)
written: object(102)
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright (c) 2022, Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0

//# publish
module 0x0.M {
import 0x2.ID;

struct Foo has key {
id: ID.VersionedID,
other: ID.VersionedID,
}

foo(f: Self.Foo) {
label l0:
_ = &mut (&mut f).Foo::other;
abort 0;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
processed 1 task

task 0 'publish'. lines 4-18:
created: object(103)
written: object(102)
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright (c) 2022, Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0

//# publish
module 0x0.M {
import 0x2.ID;

struct Foo {
id: ID.VersionedID,
}

foo(f: Self.Foo) {
label l0:
_ = &mut (&mut f).Foo::id;
abort 0;
}

}
158 changes: 0 additions & 158 deletions crates/sui-verifier/tests/id_immutable_verification_test.rs

This file was deleted.

0 comments on commit 41c5506

Please sign in to comment.