From 8f303daf458ae798b678d7e908ce5b2f27504111 Mon Sep 17 00:00:00 2001 From: Igor Aleksanov Date: Sat, 17 Oct 2020 10:56:00 +0300 Subject: Add test for new pattern functions --- crates/ide/src/completion/patterns.rs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'crates/ide') 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 { .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() { -- cgit v1.2.3