forked from christoomey/vim-tmux-navigator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpattern-check
31 lines (24 loc) · 811 Bytes
/
pattern-check
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env bash
#
# Collection of various test strings that could be the output of the tmux
# 'pane_current_comamnd' message. Included as regression test for updates to
# the inline grep pattern used in the `.tmux.conf` configuration
set -e
vim_pattern='(^|\/)g?(view|vim?)(diff)?$'
match_tests=(vim Vim VIM vimdiff /usr/local/bin/vim vi gvim view gview)
no_match_tests=( /Users/christoomey/.vim/thing /usr/local/bin/start-vim )
echo "Testing against pattern: $vim_pattern"
# Matches
echo "These should all match"
echo "----------------------"
for string in ${match_tests[@]}
do
echo $string | grep -i -E $vim_pattern
done
# No Match
echo "\nThese should not match"
echo "----------------------"
for string in ${no_match_tests[@]}
do
echo "$string $(echo $string | grep -i -E $vim_pattern)"
done