From 2a1aef1bac095b97f38ca94cfa6fddac516a1ea2 Mon Sep 17 00:00:00 2001 From: Foo Date: Sun, 30 Apr 2017 14:44:26 +0300 Subject: [PATCH] Add blank vim+vterm tests --- tests/test_in_vterm/test_vim.py | 49 +++++++++++++++++++++++++++++++++ tests/test_in_vterm/test_vim.sh | 41 +++++++++++++++++++++++++++ 2 files changed, 90 insertions(+) create mode 100755 tests/test_in_vterm/test_vim.py create mode 100755 tests/test_in_vterm/test_vim.sh diff --git a/tests/test_in_vterm/test_vim.py b/tests/test_in_vterm/test_vim.py new file mode 100755 index 00000000..ff623527 --- /dev/null +++ b/tests/test_in_vterm/test_vim.py @@ -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) diff --git a/tests/test_in_vterm/test_vim.sh b/tests/test_in_vterm/test_vim.sh new file mode 100755 index 00000000..187a9d6c --- /dev/null +++ b/tests/test_in_vterm/test_vim.sh @@ -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