-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
275 additions
and
0 deletions.
There are no files selected for viewing
121 changes: 121 additions & 0 deletions
121
crates/rooch-framework-tests/tests/cases/init_function/init_function_invalid.exp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
processed 13 tasks | ||
|
||
task 1 'publish'. lines 3-9: | ||
Error: error: module init function should not have a primitive type other than a signer | ||
┌─ /tmp/tempfile:5:5 | ||
│ | ||
5 │ ╭ fun init( _: u8 ){ | ||
6 │ │ } | ||
│ ╰─────^ | ||
|
||
|
||
|
||
task 2 'publish'. lines 11-17: | ||
Error: error: module init function should not have a primitive type other than a signer | ||
┌─ /tmp/tempfile:13:5 | ||
│ | ||
13 │ ╭ fun init( _: u16 ){ | ||
14 │ │ } | ||
│ ╰─────^ | ||
|
||
|
||
|
||
task 3 'publish'. lines 19-25: | ||
Error: error: module init function should not have a primitive type other than a signer | ||
┌─ /tmp/tempfile:21:5 | ||
│ | ||
21 │ ╭ fun init( _: u32 ){ | ||
22 │ │ } | ||
│ ╰─────^ | ||
|
||
|
||
|
||
task 4 'publish'. lines 27-33: | ||
Error: error: module init function should not have a primitive type other than a signer | ||
┌─ /tmp/tempfile:29:5 | ||
│ | ||
29 │ ╭ fun init( _: u64 ){ | ||
30 │ │ } | ||
│ ╰─────^ | ||
|
||
|
||
|
||
task 5 'publish'. lines 35-41: | ||
Error: error: module init function should not have a primitive type other than a signer | ||
┌─ /tmp/tempfile:37:5 | ||
│ | ||
37 │ ╭ fun init( _: u128 ){ | ||
38 │ │ } | ||
│ ╰─────^ | ||
|
||
|
||
|
||
task 6 'publish'. lines 43-49: | ||
Error: error: module init function should not have a primitive type other than a signer | ||
┌─ /tmp/tempfile:45:5 | ||
│ | ||
45 │ ╭ fun init( _: u256 ){ | ||
46 │ │ } | ||
│ ╰─────^ | ||
|
||
|
||
|
||
task 7 'publish'. lines 52-62: | ||
Error: error: module init function only should have two parameter types with signer or storageContext | ||
┌─ /tmp/tempfile:57:5 | ||
│ | ||
57 │ ╭ fun init( _foo: Foo ){ | ||
58 │ │ } | ||
│ ╰─────^ | ||
|
||
|
||
|
||
task 8 'publish'. lines 64-71: | ||
Error: error: module init function only should have two parameter types with signer or storageContext | ||
┌─ /tmp/tempfile:67:5 | ||
│ | ||
67 │ ╭ fun init( _: object_id::ObjectID ){ | ||
68 │ │ } | ||
│ ╰─────^ | ||
|
||
|
||
|
||
task 9 'publish'. lines 73-80: | ||
Error: error: module init function only should have two parameter types with signer or storageContext | ||
┌─ /tmp/tempfile:76:5 | ||
│ | ||
76 │ ╭ fun init( _: string::String ){ | ||
77 │ │ } | ||
│ ╰─────^ | ||
|
||
|
||
|
||
task 10 'publish'. lines 82-89: | ||
Error: error: module init function only should have two parameter types with signer or storageContext | ||
┌─ /tmp/tempfile:85:5 | ||
│ | ||
85 │ ╭ fun init( _: string::String ){ | ||
86 │ │ } | ||
│ ╰─────^ | ||
|
||
|
||
|
||
task 11 'publish'. lines 91-98: | ||
Error: error: module init function only should have two parameter types with signer or storageContext | ||
┌─ /tmp/tempfile:94:5 | ||
│ | ||
94 │ ╭ fun init( _: ascii::String ){ | ||
95 │ │ } | ||
│ ╰─────^ | ||
|
||
|
||
|
||
task 12 'publish'. lines 100-107: | ||
Error: error: module init function should not have a reference primitive type other than a signer | ||
┌─ /tmp/tempfile:103:5 | ||
│ | ||
103 │ ╭ fun init( _ : & storage_context::StorageContext){ | ||
104 │ │ } | ||
│ ╰─────^ | ||
|
||
|
107 changes: 107 additions & 0 deletions
107
crates/rooch-framework-tests/tests/cases/init_function/init_function_invalid.move
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
//# init --addresses creator=0x42 | ||
|
||
//# publish | ||
module creator::test { | ||
|
||
fun init( _: u8 ){ | ||
|
||
} | ||
} | ||
|
||
//# publish | ||
module creator::test { | ||
|
||
fun init( _: u16 ){ | ||
|
||
} | ||
} | ||
|
||
//# publish | ||
module creator::test { | ||
|
||
fun init( _: u32 ){ | ||
|
||
} | ||
} | ||
|
||
//# publish | ||
module creator::test { | ||
|
||
fun init( _: u64 ){ | ||
|
||
} | ||
} | ||
|
||
//# publish | ||
module creator::test { | ||
|
||
fun init( _: u128 ){ | ||
|
||
} | ||
} | ||
|
||
//# publish | ||
module creator::test { | ||
|
||
fun init( _: u256 ){ | ||
|
||
} | ||
} | ||
|
||
|
||
//# publish | ||
module creator::test { | ||
|
||
struct Foo has copy, drop { | ||
x: u64, | ||
} | ||
|
||
fun init( _foo: Foo ){ | ||
|
||
} | ||
} | ||
|
||
//# publish | ||
module creator::test { | ||
use moveos_std::object_id; | ||
|
||
fun init( _: object_id::ObjectID ){ | ||
|
||
} | ||
} | ||
|
||
//# publish | ||
module creator::test { | ||
use std::string; | ||
|
||
fun init( _: string::String ){ | ||
|
||
} | ||
} | ||
|
||
//# publish | ||
module creator::test { | ||
use std::string; | ||
|
||
fun init( _: string::String ){ | ||
|
||
} | ||
} | ||
|
||
//# publish | ||
module creator::test { | ||
use std::ascii; | ||
|
||
fun init( _: ascii::String ){ | ||
|
||
} | ||
} | ||
|
||
//# publish | ||
module creator::test { | ||
use moveos_std::storage_context; | ||
|
||
fun init( _ : & storage_context::StorageContext){ | ||
|
||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
crates/rooch-framework-tests/tests/cases/init_function/init_function_valid.exp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
processed 5 tasks | ||
|
||
task 1 'publish'. lines 3-9: | ||
status EXECUTED | ||
|
||
task 2 'publish'. lines 11-18: | ||
status EXECUTED | ||
|
||
task 3 'publish'. lines 20-26: | ||
status EXECUTED | ||
|
||
task 4 'publish'. lines 28-34: | ||
status EXECUTED |
34 changes: 34 additions & 0 deletions
34
crates/rooch-framework-tests/tests/cases/init_function/init_function_valid.move
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
//# init --addresses creator=0x42 | ||
|
||
//# publish | ||
module creator::test { | ||
|
||
fun init( _ : & signer){ | ||
|
||
} | ||
} | ||
|
||
//# publish | ||
module creator::test_mut_ref_storage_context { | ||
use moveos_std::storage_context; | ||
|
||
fun init( _ : &mut storage_context::StorageContext){ | ||
|
||
} | ||
} | ||
|
||
//# publish | ||
module creator::test_signer { | ||
|
||
fun init( _ : signer){ | ||
|
||
} | ||
} | ||
|
||
//# publish | ||
module creator::test_ref_signer { | ||
|
||
fun init( _ : & signer){ | ||
|
||
} | ||
} |