Add blank vim+vterm tests

This commit is contained in:
Foo 2017-04-30 14:44:26 +03:00
parent cac99271ca
commit 2a1aef1bac
2 changed files with 90 additions and 0 deletions

49
tests/test_in_vterm/test_vim.py Executable file
View File

@ -0,0 +1,49 @@
#!/usr/bin/env python
# vim:fileencoding=utf-8:noet
from __future__ import (unicode_literals, division, absolute_import, print_function)
import os
import sys
import json
from time import sleep
from subprocess import check_call
from glob import glob1
from traceback import print_exc
from tests.lib.terminal import (ExpectProcess, MutableDimensions,
do_terminal_tests, get_env)
VTERM_TEST_DIR = os.path.abspath('tests/vterm_vim')
def main(attempts=3):
vterm_path = os.path.join(VTERM_TEST_DIR, 'path')
vim_exe = os.path.join(vterm_path, 'vim')
env = get_env(vterm_path, VTERM_TEST_DIR)
dim = MutableDimensions(rows=50, cols=200)
tests = (
)
args = []
return do_terminal_tests(
tests=tests,
cmd=vim_exe,
dim=dim,
args=args,
env=env,
cwd=VTERM_TEST_DIR,
)
if __name__ == '__main__':
if main():
raise SystemExit(0)
else:
raise SystemExit(1)

41
tests/test_in_vterm/test_vim.sh Executable file
View File

@ -0,0 +1,41 @@
#!/bin/sh
. tests/common.sh
. tests/vterm.sh
. tests/vim.sh
enter_suite vim
VTERM_TEST_DIR="$ROOT/tests/vterm_vim"
vterm_setup "$VTERM_TEST_DIR"
test_vim() {
if test "$PYTHON_IMPLEMENTATION" != CPython ; then
# Can only link with cpython
return 0
fi
if ! which "$POWERLINE_VIM_EXE" ; then
return 0
fi
ln -sf "$(which "${POWERLINE_VIM_EXE}")" "$VTERM_TEST_DIR/path/vim"
f="$ROOT/tests/test_in_vterm/test_vim.py"
if ! "${PYTHON}" "$f" ; then
local test_name="$(LANG=C "$POWERLINE_VIM_EXE" --cmd 'echo version' --cmd qa 2>&1)"
fail "$test_name" F "Failed vterm test $f"
fi
}
if test -z "$POWERLINE_VIM_EXE" && test -d "$ROOT/tests/bot-ci/deps/vim"
then
for vim in "$OLD_VIM" "$NEW_VIM" ; do
export POWERLINE_VIM_EXE="$vim"
test_vim || true
done
else
export POWERLINE_VIM_EXE="${POWERLINE_VIM_EXE:-vim}"
test_vim || true
fi
vterm_shutdown "$VTERM_TEST_DIR"
exit_suite