Unverified Commit fe82d173 authored by Michael Müller's avatar Michael Müller Committed by GitHub
Browse files

Make CI check format of UI tests (#534)

* [ci] Check format of UI tests as well

* [lang] Apply our formatting guidelines to UI tests

* [ci] Make Gitlab happy

* [ci] Remove superfluous space

* [ci] Output rustfmt version

* [ci] Tune rustfmt params

* Remove todo's

* Migrate erc721 ui test contract to recent example contract

* Remove --version command used to debug

* Apply cargo fmt

* .gitlab-ci.yml formatting

* Add main fn

* Remove todo from stderr expect

* Adapt fixtures

* Revert "Adapt fixtures"

This reverts commit 174c012e.

* Adapt fixtures
parent 402a694a
Pipeline #113891 passed with stages
in 22 minutes and 50 seconds
...@@ -187,6 +187,9 @@ fmt: ...@@ -187,6 +187,9 @@ fmt:
script: script:
- cargo fmt --verbose --all -- --check - cargo fmt --verbose --all -- --check
# For the UI tests we need to disable the license check
- cargo fmt --verbose --all -- --check --config=license_template_path="" crates/lang/macro/tests/ui/{pass,fail}/*.rs
#### stage: examples #### stage: examples
......
...@@ -12,7 +12,7 @@ mod message_invalid_selector { ...@@ -12,7 +12,7 @@ mod message_invalid_selector {
} }
#[ink(message, selector = "0x00")] #[ink(message, selector = "0x00")]
pub fn invalid_selector(&self) { } pub fn invalid_selector(&self) {}
} }
} }
......
...@@ -11,7 +11,9 @@ mod non_storage_ink_impls { ...@@ -11,7 +11,9 @@ mod non_storage_ink_impls {
// This ink! impl block is okay. // This ink! impl block is okay.
impl StorageStruct { impl StorageStruct {
#[ink(constructor)] #[ink(constructor)]
pub fn constructor1() -> Self { todo!() } pub fn constructor1() -> Self {
Self {}
}
#[ink(message)] #[ink(message)]
pub fn message1(&self) {} pub fn message1(&self) {}
...@@ -25,7 +27,9 @@ mod non_storage_ink_impls { ...@@ -25,7 +27,9 @@ mod non_storage_ink_impls {
// storage struct. We expect a failure here. // storage struct. We expect a failure here.
impl NonStorageStruct { impl NonStorageStruct {
#[ink(constructor)] #[ink(constructor)]
pub fn constructor2() -> Self { todo!() } pub fn constructor2() -> Self {
Self {}
}
#[ink(message)] #[ink(message)]
pub fn message2(&self) {} pub fn message2(&self) {}
......
error[E0271]: type mismatch resolving `<NonStorageStruct as non_storage_ink_impls::_::_::{closure#0}::TypeEq>::This == StorageStruct` error[E0271]: type mismatch resolving `<NonStorageStruct as non_storage_ink_impls::_::_::{closure#0}::TypeEq>::This == StorageStruct`
--> $DIR/S-04-non-storage-ink-impls.rs:26:10 --> $DIR/S-04-non-storage-ink-impls.rs:28:10
| |
26 | impl NonStorageStruct { 28 | impl NonStorageStruct {
| ^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^
| | | |
| expected struct `StorageStruct`, found struct `NonStorageStruct` | expected struct `StorageStruct`, found struct `NonStorageStruct`
...@@ -11,24 +11,24 @@ error[E0271]: type mismatch resolving `<NonStorageStruct as non_storage_ink_impl ...@@ -11,24 +11,24 @@ error[E0271]: type mismatch resolving `<NonStorageStruct as non_storage_ink_impl
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0599]: no function or associated item named `constructor2` found for struct `StorageStruct` in the current scope error[E0599]: no function or associated item named `constructor2` found for struct `StorageStruct` in the current scope
--> $DIR/S-04-non-storage-ink-impls.rs:28:16 --> $DIR/S-04-non-storage-ink-impls.rs:30:16
| |
9 | pub struct StorageStruct {} 9 | pub struct StorageStruct {}
| ------------------------ function or associated item `constructor2` not found for this | ------------------------ function or associated item `constructor2` not found for this
... ...
28 | pub fn constructor2() -> Self { todo!() } 30 | pub fn constructor2() -> Self {
| ^^^^^^^^^^^^ | ^^^^^^^^^^^^
| | | |
| function or associated item not found in `StorageStruct` | function or associated item not found in `StorageStruct`
| help: there is an associated function with a similar name: `constructor1` | help: there is an associated function with a similar name: `constructor1`
error[E0599]: no function or associated item named `message2` found for struct `StorageStruct` in the current scope error[E0599]: no function or associated item named `message2` found for struct `StorageStruct` in the current scope
--> $DIR/S-04-non-storage-ink-impls.rs:31:16 --> $DIR/S-04-non-storage-ink-impls.rs:35:16
| |
9 | pub struct StorageStruct {} 9 | pub struct StorageStruct {}
| ------------------------ function or associated item `message2` not found for this | ------------------------ function or associated item `message2` not found for this
... ...
31 | pub fn message2(&self) {} 35 | pub fn message2(&self) {}
| ^^^^^^^^ | ^^^^^^^^
| | | |
| function or associated item not found in `StorageStruct` | function or associated item not found in `StorageStruct`
......
...@@ -10,9 +10,7 @@ mod flipper { ...@@ -10,9 +10,7 @@ mod flipper {
impl Flipper { impl Flipper {
#[ink(constructor)] #[ink(constructor)]
pub fn new(init_value: bool) -> Self { pub fn new(init_value: bool) -> Self {
Self { Self { value: init_value }
value: init_value,
}
} }
#[ink(constructor)] #[ink(constructor)]
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment