vim-plug/test/run

118 lines
2.7 KiB
Plaintext
Raw Normal View History

2014-02-11 10:09:24 -07:00
#!/bin/bash
2015-05-28 03:03:49 -07:00
cd $(dirname "${BASH_SOURCE[0]}")
2014-02-11 10:09:24 -07:00
2015-05-28 03:03:49 -07:00
export BASE="$PWD"
export PLUG_SRC="$PWD/../plug.vim"
export PLUG_FIXTURES="$PWD/fixtures"
mkdir -p "$PLUG_FIXTURES"
cat > /tmp/mini-vimrc << VIMRC
set rtp+=/tmp/junegunn/vader.vim
set shell=/bin/bash
VIMRC
clone() {
if [ ! -d $2 ]; then
git clone $1 $2
fi
}
clone_repos() (
2015-05-28 03:03:49 -07:00
cd /tmp
mkdir -p junegunn vim-scripts jg
for repo in vader.vim goyo.vim rust.vim seoul256.vim vim-easy-align vim-fnr \
vim-oblique vim-pseudocl vim-redis vim-emoji; do
clone https://github.com/junegunn/${repo}.git junegunn/$repo &
done
clone https://github.com/vim-scripts/beauty256.git vim-scripts/beauty256 &
clone https://github.com/junegunn/fzf.git fzf &
clone https://github.com/rust-lang/rust.vim.git junegunn/rust.vim &
clone https://github.com/yous/subsubmodule.git yous/subsubmodule && \
(cd yous/subsubmodule && git submodule update --init --recursive &) &
2015-05-28 03:03:49 -07:00
wait
2014-02-11 10:09:24 -07:00
2015-05-28 03:03:49 -07:00
clone junegunn/vim-emoji jg/vim-emoji
cd junegunn/seoul256.vim && git checkout no-t_co && git checkout master
)
make_dirs() (
2015-05-28 03:03:49 -07:00
rm -rf "$PLUG_FIXTURES/$1"
mkdir -p "$PLUG_FIXTURES/$1"
cd "$PLUG_FIXTURES/$1"
mkdir -p autoload colors ftdetect ftplugin indent plugin syntax
for d in *; do
[ -d $d ] || continue
cat > $d/xxx.vim << EOF
" echom expand('<sfile>')
let g:total_order = get(g:, 'total_order', [])
let g:$2 = get(g:, '$2', [])
let s:name = join(filter(['$2', '${1:4}', '$d'], '!empty(v:val)'), '/')
call add(g:$2, s:name)
call add(g:total_order, s:name)
EOF
done
)
gitinit() (
cd "$PLUG_FIXTURES/$1"
git init
git commit -m 'commit' --allow-empty
)
2014-09-26 23:19:11 -07:00
2015-05-28 03:03:49 -07:00
prepare() {
2014-09-26 23:19:11 -07:00
make_dirs xxx/ xxx
make_dirs xxx/after xxx
2015-05-28 03:03:49 -07:00
mkdir -p "$PLUG_FIXTURES/xxx/doc"
cat > "$PLUG_FIXTURES/xxx/doc/xxx.txt" << DOC
2014-08-08 20:02:03 -07:00
hello *xxx*
DOC
gitinit xxx
2014-09-26 23:19:11 -07:00
make_dirs yyy/ yyy
make_dirs yyy/after yyy
gitinit yyy
2014-09-26 23:19:11 -07:00
make_dirs z1/ z1
make_dirs z2/ z2
2015-05-28 03:03:49 -07:00
rm -rf "$PLUG_FIXTURES/ftplugin-msg"
mkdir -p "$PLUG_FIXTURES/ftplugin-msg/ftplugin"
echo "echomsg 'ftplugin'" > "$PLUG_FIXTURES/ftplugin-msg/ftplugin/c.vim"
2015-05-28 03:03:49 -07:00
rm -rf /tmp/new-branch
cd /tmp
git init new-branch
cd new-branch
mkdir plugin
echo 'let g:foo = 1' > plugin/foo.vim
git add plugin/foo.vim
git commit -m initial
cd "$BASE"
}
2014-06-22 20:47:13 -07:00
select_vim() {
local vim=/usr/bin/vim
if [ -n "$DEPS" ] && [ -e "${DEPS}/bin/vim" ]; then
vim="${DEPS}/bin/vim"
elif [ -e "/usr/local/bin/vim" ]; then
vim=/usr/local/bin/vim
fi
echo $vim
}
2015-05-28 03:03:49 -07:00
clone_repos
prepare
VIM=$(select_vim)
echo "Selected Vim: $VIM"
2014-06-22 20:47:13 -07:00
if [ "$1" = '!' ]; then
$VIM -Nu /tmp/mini-vimrc -c 'Vader! test.vader' > /dev/null &&
2015-05-28 03:03:49 -07:00
prepare &&
$VIM -Nu /tmp/mini-vimrc -c 'let g:plug_threads = 1 | Vader! test.vader' > /dev/null
2014-06-22 20:47:13 -07:00
else
$VIM -Nu /tmp/mini-vimrc -c 'Vader test.vader'
2014-06-22 20:47:13 -07:00
fi
2014-02-11 10:09:24 -07:00