diff options
Diffstat (limited to 'crates/ide/src/completion')
-rw-r--r-- | crates/ide/src/completion/patterns.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/crates/ide/src/completion/patterns.rs b/crates/ide/src/completion/patterns.rs index 76fcad631..f00ddeed7 100644 --- a/crates/ide/src/completion/patterns.rs +++ b/crates/ide/src/completion/patterns.rs | |||
@@ -123,6 +123,10 @@ pub(crate) fn fn_is_prev(element: SyntaxElement) -> bool { | |||
123 | .filter(|it| it.kind() == FN_KW) | 123 | .filter(|it| it.kind() == FN_KW) |
124 | .is_some() | 124 | .is_some() |
125 | } | 125 | } |
126 | #[test] | ||
127 | fn test_fn_is_prev() { | ||
128 | check_pattern_is_applicable(r"fn l<|>", fn_is_prev); | ||
129 | } | ||
126 | 130 | ||
127 | /// Check if the token previous to the previous one is `for`. | 131 | /// Check if the token previous to the previous one is `for`. |
128 | /// For example, `for _ i<|>` => true. | 132 | /// For example, `for _ i<|>` => true. |
@@ -134,6 +138,10 @@ pub(crate) fn for_is_prev2(element: SyntaxElement) -> bool { | |||
134 | .filter(|it| it.kind() == FOR_KW) | 138 | .filter(|it| it.kind() == FOR_KW) |
135 | .is_some() | 139 | .is_some() |
136 | } | 140 | } |
141 | #[test] | ||
142 | fn test_for_is_prev2() { | ||
143 | check_pattern_is_applicable(r"for i i<|>", for_is_prev2); | ||
144 | } | ||
137 | 145 | ||
138 | #[test] | 146 | #[test] |
139 | fn test_if_is_prev() { | 147 | fn test_if_is_prev() { |