Add test for new pattern functions

This commit is contained in:
Igor Aleksanov 2020-10-17 10:56:00 +03:00
parent 6ae4c70a0a
commit 8f303daf45

View file

@ -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() {