mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 14:21:44 +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)
|
.filter(|it| it.kind() == FN_KW)
|
||||||
.is_some()
|
.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`.
|
/// Check if the token previous to the previous one is `for`.
|
||||||
/// For example, `for _ i<|>` => true.
|
/// For example, `for _ i<|>` => true.
|
||||||
|
@ -134,6 +138,10 @@ pub(crate) fn for_is_prev2(element: SyntaxElement) -> bool {
|
||||||
.filter(|it| it.kind() == FOR_KW)
|
.filter(|it| it.kind() == FOR_KW)
|
||||||
.is_some()
|
.is_some()
|
||||||
}
|
}
|
||||||
|
#[test]
|
||||||
|
fn test_for_is_prev2() {
|
||||||
|
check_pattern_is_applicable(r"for i i<|>", for_is_prev2);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_if_is_prev() {
|
fn test_if_is_prev() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue