Skip to content

Commit

Permalink
Check test consistency (#5375)
Browse files Browse the repository at this point in the history
## Description

This PR extends tests with the checks that prove that the E2e and the
SDK harness tests are consistent. In the first step, we are checking the
test Forc.toml files for the following aspects:
- proper `authors`
- proper `license`
- proper `implicit-std`
- proper import of standard libraries

The last two points are of particular importance, because they can cause
tests fail when, e.g., bumping to new versions. These checks will
eliminate the issues like we had [when merging Bump to
v0.48.0](#5275 (comment)).

The PR also fixes issues found in existing tests, most notably:
- unrelated test project names that stayed after copy-pasting tests
- `authors` different than _Fuel Labs_
- inconsistent lib import paths

## Demo

![Various
errors](https://github.com/FuelLabs/sway/assets/4142833/ef707a37-e672-40d4-8af7-4848e69fa582)

![Std library is not properly
imported](https://github.com/FuelLabs/sway/assets/4142833/0a9de98b-fc5a-455a-9877-28b4111f4c67)

## Checklist

- [x] I have linked to any relevant issues.
- [x] I have commented my code, particularly in hard-to-understand
areas.
- [ ] I have updated the documentation where relevant (API docs, the
reference, and the Sway book).
- [ ] I have added tests that prove my fix is effective or that my
feature works.
- [ ] I have added (or requested a maintainer to add) the necessary
`Breaking*` or `New Feature` labels where relevant.
- [x] I have done my best to ensure that my PR adheres to [the Fuel Labs
Code Review
Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md).
- [x] I have requested a review from the relevant team or maintainers.
  • Loading branch information
ironcev authored Dec 7, 2023
1 parent 764ed7c commit d8c87f8
Show file tree
Hide file tree
Showing 138 changed files with 589 additions and 372 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[[package]]
name = 'addrof_intrinsic'
source = 'member'
dependencies = ['std']
name = "annotated_missing_item"
source = "member"
dependencies = ["std"]

[[package]]
name = 'core'
source = 'path+from-root-B3EAB3022B5FAD04'
name = "core"
source = "path+from-root-7215716CB6117AD4"

[[package]]
name = 'std'
source = 'path+from-root-B3EAB3022B5FAD04'
dependencies = ['core']
name = "std"
source = "path+from-root-7215716CB6117AD4"
dependencies = ["core"]
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
authors = ["Fuel Labs <[email protected]>"]
entry = "main.sw"
license = "Apache-2.0"
name = "addrof_intrinsic"
name = "annotated_missing_item"

[dependencies]
std = { path = "../../../../../../sway-lib-std" }
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[[package]]
name = 'conditional_compilation_bad_program_type'
source = 'member'
name = "bad_program_type"
source = "member"
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ authors = ["Fuel Labs <[email protected]>"]
entry = "main.sw"
implicit-std = false
license = "Apache-2.0"
name = "conditional_compilation_bad_program_type"
name = "bad_program_type"
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[[package]]
name = 'conditional_compilation_bad_target'
source = 'member'
name = "bad_target"
source = "member"
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ authors = ["Fuel Labs <[email protected]>"]
entry = "main.sw"
implicit-std = false
license = "Apache-2.0"
name = "conditional_compilation_bad_target"
name = "bad_target"

Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[[package]]
name = 'conditional_compilation_mismatching_program_type'
source = 'member'
name = "mismatching_program_type"
source = "member"
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ authors = ["Fuel Labs <[email protected]>"]
entry = "main.sw"
implicit-std = false
license = "Apache-2.0"
name = "conditional_compilation_mismatching_program_type"
name = "mismatching_program_type"
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[[package]]
name = 'conditional_compilation_no_target'
source = 'member'
name = "no_target"
source = "member"
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ authors = ["Fuel Labs <[email protected]>"]
entry = "main.sw"
implicit-std = false
license = "Apache-2.0"
name = "conditional_compilation_no_target"
name = "no_target"

Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[[package]]
name = 'valid_impurity'
source = 'member'
name = "contract_pure_calls_impure"
source = "member"
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
authors = ["Fuel Labs <[email protected]>"]
license = "Apache-2.0"
name = "valid_impurity"
name = "contract_pure_calls_impure"
entry = "main.sw"
implicit-std = false
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[[package]]
name = 'disallowed_opcodes'
source = 'member'
name = "disallowed_gm"
source = "member"
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
authors = ["Fuel Labs <[email protected]>"]
license = "Apache-2.0"
name = "disallowed_opcodes"
name = "disallowed_gm"
entry = "main.sw"
implicit-std = false
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[[package]]
name = 'double_underscore_fn'
source = 'member'
name = "double_underscore_impl_self_fn"
source = "member"
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
authors = ["Fuel Labs <[email protected]>"]
entry = "main.sw"
license = "Apache-2.0"
name = "double_underscore_fn"
name = "double_underscore_impl_self_fn"
implicit-std = false
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[[package]]
name = 'double_underscore_fn'
source = 'member'
name = "double_underscore_trait_fn"
source = "member"
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
authors = ["Fuel Labs <[email protected]>"]
entry = "main.sw"
license = "Apache-2.0"
name = "double_underscore_fn"
name = "double_underscore_trait_fn"
implicit-std = false
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
authors = ["Fuel Labs <[email protected]>"]
entry = "main.sw"
license = "Apache-2.0"
name = "contract"
name = "contract" # NAME_NO_CHECK
implicit-std = false

[dependencies]
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
authors = ["Fuel Labs <[email protected]>"]
entry = "main.sw"
license = "Apache-2.0"
name = "script"
name = "script" # NAME_NO_CHECK
implicit-std = false

[dependencies]
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ authors = ["Fuel Labs <[email protected]>"]
license = "Apache-2.0"
name = "excess_method_arguments"
entry = "main.sw"
implicit-std = false

[dependencies]
core = { path = "../../../../../../sway-lib-core" }
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
authors = ["Fuel Labs <[email protected]>"]
entry = "main.sw"
license = "Apache-2.0"
name = "test_contract"
name = "nested_package"
implicit-std = false
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[[package]]
name = "core"
source = "path+from-root-151EC6D60D03100D"
source = "path+from-root-1137881413C24890"

[[package]]
name = "impl_with_constraint"
name = "generic_empty_struct_with_constraint"
source = "member"
dependencies = ["std"]

[[package]]
name = "std"
source = "path+from-root-151EC6D60D03100D"
source = "path+from-root-1137881413C24890"
dependencies = ["core"]
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
authors = ["Fuel Labs <[email protected]>"]
entry = "main.sw"
license = "Apache-2.0"
name = "impl_with_constraint"
name = "generic_empty_struct_with_constraint"

[dependencies]
std = { path = "../../../../../../sway-lib-std" }
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ authors = ["Fuel Labs <[email protected]>"]
license = "Apache-2.0"
name = "missing_fn_arguments"
entry = "main.sw"
implicit-std = false

[dependencies]
core = { path = "../../../../../../sway-lib-core" }
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[[package]]
name = 'core'
source = 'path+from-root-71DB3AC72E68AF59'
name = "core"
source = "path+from-root-2661557639CEB78D"

[[package]]
name = 'missing_type_parameteres'
source = 'member'
dependencies = ['std']
name = "missing_type_parameters"
source = "member"
dependencies = ["std"]

[[package]]
name = 'std'
source = 'path+from-root-71DB3AC72E68AF59'
dependencies = ['core']
name = "std"
source = "path+from-root-2661557639CEB78D"
dependencies = ["core"]
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
authors = ["Fuel Labs <[email protected]>"]
entry = "main.sw"
license = "Apache-2.0"
name = "missing_type_parameteres"
name = "missing_type_parameters"

[dependencies]
std = { path = "../../../../../../sway-lib-std" }
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[[package]]
name = 'core'
source = 'path+from-root-BC4E87DB22234D76'
name = "core"
source = "path+from-root-A623365D2AB292FA"

[[package]]
name = 'repeated_storage_field'
source = 'member'
dependencies = ['std']
name = "nonconst_storage_init"
source = "member"
dependencies = ["std"]

[[package]]
name = 'std'
source = 'path+from-root-BC4E87DB22234D76'
dependencies = ['core']
name = "std"
source = "path+from-root-A623365D2AB292FA"
dependencies = ["core"]
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
authors = ["Fuel Labs <[email protected]>"]
entry = "main.sw"
license = "Apache-2.0"
name = "repeated_storage_field"
name = "nonconst_storage_init"

[dependencies]
std = { path = "../../../../../../sway-lib-std" }
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[[package]]
name = 'script_calls_impure'
source = 'member'
name = "predicate_calls_impure"
source = "member"
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
authors = ["Fuel Labs <[email protected]>"]
license = "Apache-2.0"
name = "script_calls_impure"
name = "predicate_calls_impure"
entry = "main.sw"
implicit-std = false
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[[package]]
name = 'unused_generic'
source = 'member'
name = "primitive_type_argument"
source = "member"
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
authors = ["Fuel Labs <[email protected]>"]
entry = "main.sw"
license = "Apache-2.0"
name = "unused_generic"
name = "primitive_type_argument"
implicit-std = false
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[[package]]
name = 'recover_invalid_items'
source = 'member'
name = "recover_at_level_inside_items"
source = "member"
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[project]
name = "recover_invalid_items"
name = "recover_at_level_inside_items"
authors = ["Fuel Labs <[email protected]>"]
entry = "main.sw"
license = "Apache-2.0"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[[package]]
name = 'recover_letx_no_expr'
source = 'member'
name = "recover_at_level_statement"
source = "member"
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[project]
name = "recover_letx_no_expr"
name = "recover_at_level_statement"
authors = ["Fuel Labs <[email protected]>"]
entry = "main.sw"
license = "Apache-2.0"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[[package]]
name = 'recover_invalid_items'
source = 'member'
name = "recover_at_level_top"
source = "member"
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[project]
name = "recover_invalid_items"
name = "recover_at_level_top"
authors = ["Fuel Labs <[email protected]>"]
entry = "main.sw"
license = "Apache-2.0"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[[package]]
name = 'shadowed_types_and_traits'
source = 'member'
name = "shadowed_types_and_traits_alias"
source = "member"
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ authors = ["Fuel Labs <[email protected]>"]
entry = "main.sw"
implicit-std = false
license = "Apache-2.0"
name = "shadowed_types_and_traits"
name = "shadowed_types_and_traits_alias"
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[[package]]
name = 'abi_impl_purity_mismatch'
source = 'member'
dependencies = ['std']
name = "core"
source = "path+from-root-BB0D5D60D9FB76A1"

[[package]]
name = 'core'
source = 'path+from-root-F8710BB88FA26760'
name = "std"
source = "path+from-root-BB0D5D60D9FB76A1"
dependencies = ["core"]

[[package]]
name = 'std'
source = 'path+from-root-F8710BB88FA26760'
dependencies = ['core']
name = "storage_clear_incorrect_purity_annotation"
source = "member"
dependencies = ["std"]
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
authors = ["Fuel Labs <[email protected]>"]
entry = "main.sw"
license = "Apache-2.0"
name = "abi_impl_purity_mismatch"
name = "storage_clear_incorrect_purity_annotation"

[dependencies]
std = { path = "../../../../../../../sway/sway-lib-std" }
std = { path = "../../../../../../sway-lib-std" }
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[[package]]
name = 'superabi_duplicate_methods4'
source = 'member'
name = "superabi_duplicate_methods10"
source = "member"
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[project]
name = "superabi_duplicate_methods4"
name = "superabi_duplicate_methods10"
authors = ["Fuel Labs <[email protected]>"]
entry = "main.sw"
license = "Apache-2.0"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[[package]]
name = 'superabi_duplicate_methods1'
source = 'member'
name = "superabi_duplicate_methods2"
source = "member"
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[project]
name = "superabi_duplicate_methods1"
name = "superabi_duplicate_methods2"
authors = ["Fuel Labs <[email protected]>"]
entry = "main.sw"
license = "Apache-2.0"
Expand Down
Loading

0 comments on commit d8c87f8

Please sign in to comment.