-
Notifications
You must be signed in to change notification settings - Fork 276
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add ui test for filtering singular queries in smart contracts
Signed-off-by: Nikita Strygin <[email protected]>
- Loading branch information
Showing
5 changed files
with
48 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#![cfg(not(coverage))] | ||
use trybuild::TestCases; | ||
|
||
#[cfg(not(target_arch = "wasm32"))] | ||
#[test] | ||
fn ui() { | ||
let test_cases = TestCases::new(); | ||
test_cases.compile_fail("tests/ui_fail/*.rs"); | ||
} |
12 changes: 12 additions & 0 deletions
12
smart_contract/tests/ui_fail/cant_filter_singular_query.rs
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,12 @@ | ||
use iroha_smart_contract::{ | ||
data_model::query::predicate::{string::StringPredicate, value::QueryOutputPredicate}, | ||
prelude::*, | ||
}; | ||
|
||
fn main() { | ||
FindPermissionSchema | ||
.filter(QueryOutputPredicate::Identifiable( | ||
StringPredicate::starts_with("xor_"), | ||
)) | ||
.execute() | ||
} |
25 changes: 25 additions & 0 deletions
25
smart_contract/tests/ui_fail/cant_filter_singular_query.stderr
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,25 @@ | ||
error[E0599]: the method `filter` exists for struct `FindPermissionSchema`, but its trait bounds were not satisfied | ||
--> tests/ui_fail/cant_filter_singular_query.rs:8:10 | ||
| | ||
7 | / FindPermissionSchema | ||
8 | | .filter(QueryOutputPredicate::Identifiable( | ||
| | -^^^^^^ method cannot be called on `FindPermissionSchema` due to unsatisfied trait bounds | ||
| |_________| | ||
| | ||
| | ||
::: $WORKSPACE/data_model/src/query/mod.rs | ||
| | ||
| / queries! { | ||
| | /// Finds all registered permission tokens | ||
| | #[derive(Copy, Display)] | ||
| | #[ffi_type] | ||
... | | ||
| | } | ||
| | } | ||
| |_____- doesn't satisfy `_: ExecuteIterableQueryOnHost`, `_: IterableQuery` or `_: Iterator` | ||
| | ||
= note: the following trait bounds were not satisfied: | ||
`iroha_smart_contract::prelude::FindPermissionSchema: IterableQuery` | ||
which is required by `iroha_smart_contract::prelude::FindPermissionSchema: iroha_smart_contract::ExecuteIterableQueryOnHost` | ||
`iroha_smart_contract::prelude::FindPermissionSchema: Iterator` | ||
which is required by `&mut iroha_smart_contract::prelude::FindPermissionSchema: Iterator` |