Skip to content

Commit

Permalink
[move] Add more enums tests (#18241)
Browse files Browse the repository at this point in the history
## Description 

Adds some more tests for enums in Move

## Test plan 

Added a bunch new tests.
  • Loading branch information
tzakian authored Jun 13, 2024
1 parent ef071fd commit d439e86
Show file tree
Hide file tree
Showing 25 changed files with 579 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
processed 6 tasks

task 1 'publish'. lines 6-37:
Error: Transaction Effects Status: Sui Move Bytecode Verification Error. Please run the Sui Move Verifier for more information.
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: SuiMoveVerificationError, source: Some("Enum X cannot have the 'key' ability. Enums cannot have the 'key' ability."), command: Some(0) } }

task 2 'set-address'. lines 39-39:
Error: INVALID TEST. Unknown object, object(1,0)

task 3 'run'. lines 41-41:
Error: Error checking transaction input objects: DependentPackageNotFound { package_id: 0x0000000000000000000000000000000000000000000000000000000000000000 }

task 4 'run'. lines 43-43:
Error: Error checking transaction input objects: DependentPackageNotFound { package_id: 0x0000000000000000000000000000000000000000000000000000000000000000 }

task 5 'run'. lines 45-45:
Error: Error checking transaction input objects: DependentPackageNotFound { package_id: 0x0000000000000000000000000000000000000000000000000000000000000000 }
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// Copyright (c) Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0

//# init --addresses test=0x0

//# publish
module 0x0.f {
import 0x2.transfer;

enum X has key {
A { }
}

public transfer() {
let x: Self.X;
label l0:
x = X.A { };
transfer.transfer<Self.X>(move(x), 0x0);
return;
}

public share() {
let x: Self.X;
label l0:
x = X.A { };
transfer.share_object<Self.X>(move(x));
return;
}

public freezer() {
let x: Self.X;
label l0:
x = X.A { };
transfer.freeze_object<Self.X>(move(x));
return;
}
}

//# set-address test object(1,0)

//# run test::f::transfer

//# run test::f::share

//# run test::f::freezer
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
processed 6 tasks

task 1 'publish'. lines 6-45:
Error: Transaction Effects Status: Sui Move Bytecode Verification Error. Please run the Sui Move Verifier for more information.
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: SuiMoveVerificationError, source: Some("Enum X cannot have the 'key' ability. Enums cannot have the 'key' ability."), command: Some(0) } }

task 2 'set-address'. lines 47-47:
Error: INVALID TEST. Unknown object, object(1,0)

task 3 'run'. lines 49-49:
Error: Error checking transaction input objects: DependentPackageNotFound { package_id: 0x0000000000000000000000000000000000000000000000000000000000000000 }

task 4 'run'. lines 51-51:
Error: Error checking transaction input objects: DependentPackageNotFound { package_id: 0x0000000000000000000000000000000000000000000000000000000000000000 }

task 5 'run'. lines 53-53:
Error: Error checking transaction input objects: DependentPackageNotFound { package_id: 0x0000000000000000000000000000000000000000000000000000000000000000 }
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// Copyright (c) Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0

//# init --addresses test=0x0

//# publish
module 0x0.f {
import 0x2.transfer;
import 0x2.object;
import 0x2.tx_context;

enum X has key {
A { id: object.UID }
}

public transfer(ctx: &mut tx_context.TxContext) {
let x: Self.X;
let id: object.UID;
label l0:
id = object.new(move(ctx));
x = X.A { id: move(id) };
transfer.transfer<Self.X>(move(x), 0x0);
return;
}

public share(ctx: &mut tx_context.TxContext) {
let x: Self.X;
let id: object.UID;
label l0:
id = object.new(move(ctx));
x = X.A { id: move(id) };
transfer.share_object<Self.X>(move(x));
return;
}

public freezer(ctx: &mut tx_context.TxContext) {
let x: Self.X;
let id: object.UID;
label l0:
id = object.new(move(ctx));
x = X.A { id: move(id) };
transfer.freeze_object<Self.X>(move(x));
return;
}
}

//# set-address test object(1,0)

//# run test::f::transfer

//# run test::f::share

//# run test::f::freezer
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
processed 11 tasks

task 1 'publish'. lines 6-88:
Error: Transaction Effects Status: Sui Move Bytecode Verification Error. Please run the Sui Move Verifier for more information.
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: SuiMoveVerificationError, source: Some("Enum X cannot have the 'key' ability. Enums cannot have the 'key' ability."), command: Some(0) } }

task 2 'set-address'. lines 90-90:
Error: INVALID TEST. Unknown object, object(1,0)

task 3 'run'. lines 92-92:
Error: Error checking transaction input objects: DependentPackageNotFound { package_id: 0x0000000000000000000000000000000000000000000000000000000000000000 }

task 4 'run'. lines 94-94:
Error: Error checking transaction input objects: DependentPackageNotFound { package_id: 0x0000000000000000000000000000000000000000000000000000000000000000 }

task 5 'run'. lines 96-96:
Error: Error checking transaction input objects: DependentPackageNotFound { package_id: 0x0000000000000000000000000000000000000000000000000000000000000000 }

task 6 'run'. lines 98-98:
Error: Error checking transaction input objects: DependentPackageNotFound { package_id: 0x0000000000000000000000000000000000000000000000000000000000000000 }

task 7 'run'. lines 100-100:
Error: Error checking transaction input objects: DependentPackageNotFound { package_id: 0x0000000000000000000000000000000000000000000000000000000000000000 }

task 8 'run'. lines 102-102:
Error: Error checking transaction input objects: DependentPackageNotFound { package_id: 0x0000000000000000000000000000000000000000000000000000000000000000 }

task 9 'run'. lines 104-104:
Error: Error checking transaction input objects: DependentPackageNotFound { package_id: 0x0000000000000000000000000000000000000000000000000000000000000000 }

task 10 'run'. lines 106-106:
Error: Error checking transaction input objects: DependentPackageNotFound { package_id: 0x0000000000000000000000000000000000000000000000000000000000000000 }
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
// Copyright (c) Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0

//# init --addresses test=0x0

//# publish
module 0x0.f {
import 0x2.transfer;
import 0x2.object;
import 0x2.dynamic_field;
import 0x2.dynamic_object_field;
import 0x2.tx_context;

enum X has store, key {
A { }
}

public transfer() {
let x: Self.X;
label l0:
x = X.A { };
transfer.transfer<Self.X>(move(x), 0x0);
return;
}

public share() {
let x: Self.X;
label l0:
x = X.A { };
transfer.share_object<Self.X>(move(x));
return;
}

public public_transfer() {
let x: Self.X;
label l0:
x = X.A { };
transfer.public_transfer<Self.X>(move(x), 0x0);
return;
}

public public_share() {
let x: Self.X;
label l0:
x = X.A { };
transfer.public_share_object<Self.X>(move(x));
return;
}

public freezer() {
let x: Self.X;
label l0:
x = X.A { };
transfer.freeze_object<Self.X>(move(x));
return;
}

public public_freezer() {
let x: Self.X;
label l0:
x = X.A { };
transfer.public_freeze_object<Self.X>(move(x));
return;
}

public add_as_df(ctx: &mut tx_context.TxContext) {
let x: Self.X;
let id: object.UID;
label l0:
id = object.new(move(ctx));
x = X.A { };
dynamic_field.add<u64, Self.X>(&mut id, 0, move(x));
object.delete(move(id));
return;

}

public dof_add(ctx: &mut tx_context.TxContext) {
let x: Self.X;
let id: object.UID;
label l0:
id = object.new(move(ctx));
x = X.A { };
dynamic_object_field.add<u64, Self.X>(&mut id, 0, move(x));
object.delete(move(id));
return;
}
}

//# set-address test object(1,0)

//# run test::f::transfer

//# run test::f::share

//# run test::f::public_transfer

//# run test::f::public_share

//# run test::f::freezer

//# run test::f::public_freezer

//# run test::f::add_df

//# run test::f::add_dof
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
processed 11 tasks

task 1 'publish'. lines 6-104:
Error: Transaction Effects Status: Sui Move Bytecode Verification Error. Please run the Sui Move Verifier for more information.
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: SuiMoveVerificationError, source: Some("Enum X cannot have the 'key' ability. Enums cannot have the 'key' ability."), command: Some(0) } }

task 2 'set-address'. lines 106-106:
Error: INVALID TEST. Unknown object, object(1,0)

task 3 'run'. lines 108-108:
Error: Error checking transaction input objects: DependentPackageNotFound { package_id: 0x0000000000000000000000000000000000000000000000000000000000000000 }

task 4 'run'. lines 110-110:
Error: Error checking transaction input objects: DependentPackageNotFound { package_id: 0x0000000000000000000000000000000000000000000000000000000000000000 }

task 5 'run'. lines 112-112:
Error: Error checking transaction input objects: DependentPackageNotFound { package_id: 0x0000000000000000000000000000000000000000000000000000000000000000 }

task 6 'run'. lines 114-114:
Error: Error checking transaction input objects: DependentPackageNotFound { package_id: 0x0000000000000000000000000000000000000000000000000000000000000000 }

task 7 'run'. lines 116-116:
Error: Error checking transaction input objects: DependentPackageNotFound { package_id: 0x0000000000000000000000000000000000000000000000000000000000000000 }

task 8 'run'. lines 118-118:
Error: Error checking transaction input objects: DependentPackageNotFound { package_id: 0x0000000000000000000000000000000000000000000000000000000000000000 }

task 9 'run'. lines 120-120:
Error: Error checking transaction input objects: DependentPackageNotFound { package_id: 0x0000000000000000000000000000000000000000000000000000000000000000 }

task 10 'run'. lines 122-122:
Error: Error checking transaction input objects: DependentPackageNotFound { package_id: 0x0000000000000000000000000000000000000000000000000000000000000000 }
Loading

0 comments on commit d439e86

Please sign in to comment.