mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-11-15 01:17:27 +00:00
Add test for new pattern functions
This commit is contained in:
parent
6ae4c70a0a
commit
8f303daf45
1 changed files with 8 additions and 0 deletions
|
@ -123,6 +123,10 @@ pub(crate) fn fn_is_prev(element: SyntaxElement) -> bool {
|
|||
.filter(|it| it.kind() == FN_KW)
|
||||
.is_some()
|
||||
}
|
||||
#[test]
|
||||
fn test_fn_is_prev() {
|
||||
check_pattern_is_applicable(r"fn l<|>", fn_is_prev);
|
||||
}
|
||||
|
||||
/// Check if the token previous to the previous one is `for`.
|
||||
/// For example, `for _ i<|>` => true.
|
||||
|
@ -134,6 +138,10 @@ pub(crate) fn for_is_prev2(element: SyntaxElement) -> bool {
|
|||
.filter(|it| it.kind() == FOR_KW)
|
||||
.is_some()
|
||||
}
|
||||
#[test]
|
||||
fn test_for_is_prev2() {
|
||||
check_pattern_is_applicable(r"for i i<|>", for_is_prev2);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_if_is_prev() {
|
||||
|
|
Loading…
Reference in a new issue