Skip to content

Commit 8f303da

Browse files
committed
Add test for new pattern functions
1 parent 6ae4c70 commit 8f303da

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

crates/ide/src/completion/patterns.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,10 @@ pub(crate) fn fn_is_prev(element: SyntaxElement) -> bool {
123123
.filter(|it| it.kind() == FN_KW)
124124
.is_some()
125125
}
126+
#[test]
127+
fn test_fn_is_prev() {
128+
check_pattern_is_applicable(r"fn l<|>", fn_is_prev);
129+
}
126130

127131
/// Check if the token previous to the previous one is `for`.
128132
/// For example, `for _ i<|>` => true.
@@ -134,6 +138,10 @@ pub(crate) fn for_is_prev2(element: SyntaxElement) -> bool {
134138
.filter(|it| it.kind() == FOR_KW)
135139
.is_some()
136140
}
141+
#[test]
142+
fn test_for_is_prev2() {
143+
check_pattern_is_applicable(r"for i i<|>", for_is_prev2);
144+
}
137145

138146
#[test]
139147
fn test_if_is_prev() {

0 commit comments

Comments
 (0)