forked from FuelLabs/sway
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow script main fns to have args (FuelLabs#2592)
* Allow script and predicate main fns to receive args * Update sway-core/src/error.rs Co-authored-by: Mohammad Fawaz <[email protected]> * error fix * add test for various types * move failing test * fix path * remove length check Co-authored-by: Mohammad Fawaz <[email protected]>
- Loading branch information
1 parent
3c83178
commit d083ea6
Showing
57 changed files
with
778 additions
and
45 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
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
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
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
9 changes: 9 additions & 0 deletions
9
test/src/e2e_vm_tests/test_programs/should_fail/main_args/main_args_mutation/Forc.lock
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,9 @@ | ||
[[package]] | ||
name = 'core' | ||
source = 'path+from-root-2F8090B18C264A91' | ||
dependencies = [] | ||
|
||
[[package]] | ||
name = 'main_args_mutation' | ||
source = 'root' | ||
dependencies = ['core'] |
9 changes: 9 additions & 0 deletions
9
test/src/e2e_vm_tests/test_programs/should_fail/main_args/main_args_mutation/Forc.toml
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,9 @@ | ||
[project] | ||
authors = ["Fuel Labs <[email protected]>"] | ||
entry = "main.sw" | ||
license = "Apache-2.0" | ||
name = "main_args_mutation" | ||
implicit-std = false | ||
|
||
[dependencies] | ||
core = { path = "../../../../../../../sway-lib-core" } |
42 changes: 42 additions & 0 deletions
42
.../e2e_vm_tests/test_programs/should_fail/main_args/main_args_mutation/json_abi_oracle.json
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,42 @@ | ||
[ | ||
{ | ||
"inputs": [ | ||
{ | ||
"components": [ | ||
{ | ||
"components": null, | ||
"name": "val", | ||
"type": "u64", | ||
"typeArguments": null | ||
} | ||
], | ||
"name": "baba", | ||
"type": "struct TestStruct", | ||
"typeArguments": null | ||
}, | ||
{ | ||
"components": [ | ||
{ | ||
"components": null, | ||
"name": "val", | ||
"type": "u64", | ||
"typeArguments": null | ||
} | ||
], | ||
"name": "keke", | ||
"type": "struct TestStruct", | ||
"typeArguments": null | ||
} | ||
], | ||
"name": "main", | ||
"outputs": [ | ||
{ | ||
"components": null, | ||
"name": "", | ||
"type": "u64", | ||
"typeArguments": null | ||
} | ||
], | ||
"type": "function" | ||
} | ||
] |
10 changes: 10 additions & 0 deletions
10
test/src/e2e_vm_tests/test_programs/should_fail/main_args/main_args_mutation/src/main.sw
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,10 @@ | ||
script; | ||
|
||
struct TestStruct { | ||
val: u64, | ||
} | ||
|
||
fn main(ref mut baba: TestStruct) -> u64 { | ||
baba.val += 1; | ||
baba.val | ||
} |
4 changes: 4 additions & 0 deletions
4
test/src/e2e_vm_tests/test_programs/should_fail/main_args/main_args_mutation/test.toml
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,4 @@ | ||
category = "fail" | ||
|
||
# check: fn main(ref mut baba: TestStruct) -> u64 { | ||
# nextln: $()ref mut parameter not allowed for main() |
4 changes: 0 additions & 4 deletions
4
test/src/e2e_vm_tests/test_programs/should_fail/main_should_not_have_args/Forc.lock
This file was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
test/src/e2e_vm_tests/test_programs/should_fail/main_should_not_have_args/Forc.toml
This file was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
test/src/e2e_vm_tests/test_programs/should_fail/main_should_not_have_args/src/main.sw
This file was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
test/src/e2e_vm_tests/test_programs/should_fail/main_should_not_have_args/src/pred.sw
This file was deleted.
Oops, something went wrong.
4 changes: 0 additions & 4 deletions
4
test/src/e2e_vm_tests/test_programs/should_fail/main_should_not_have_args/test.toml
This file was deleted.
Oops, something went wrong.
9 changes: 9 additions & 0 deletions
9
test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_copy/Forc.lock
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,9 @@ | ||
[[package]] | ||
name = 'core' | ||
source = 'path+from-root-EE00857339AC041F' | ||
dependencies = [] | ||
|
||
[[package]] | ||
name = 'main_args_copy' | ||
source = 'root' | ||
dependencies = ['core'] |
9 changes: 9 additions & 0 deletions
9
test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_copy/Forc.toml
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,9 @@ | ||
[project] | ||
authors = ["Fuel Labs <[email protected]>"] | ||
entry = "main.sw" | ||
license = "Apache-2.0" | ||
name = "main_args_copy" | ||
implicit-std = false | ||
|
||
[dependencies] | ||
core = { path = "../../../../../../../../sway-lib-core" } |
Oops, something went wrong.