summaryrefslogtreecommitdiffstats
path: root/tests/test_in_vterm/test_vim.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 02:04:06 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 02:04:06 +0000
commita8637fe80c24fb04bf6cc8ae8459877535f1341b (patch)
tree5d263b4543e10940f5e9a79a8fe981c5a3414bd7 /tests/test_in_vterm/test_vim.py
parentInitial commit. (diff)
downloadpowerline-a8637fe80c24fb04bf6cc8ae8459877535f1341b.tar.xz
powerline-a8637fe80c24fb04bf6cc8ae8459877535f1341b.zip
Adding upstream version 2.7.upstream/2.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/test_in_vterm/test_vim.py')
-rwxr-xr-xtests/test_in_vterm/test_vim.py73
1 files changed, 73 insertions, 0 deletions
diff --git a/tests/test_in_vterm/test_vim.py b/tests/test_in_vterm/test_vim.py
new file mode 100755
index 0000000..0fbc319
--- /dev/null
+++ b/tests/test_in_vterm/test_vim.py
@@ -0,0 +1,73 @@
+#!/usr/bin/env python
+# vim:fileencoding=utf-8:noet
+from __future__ import (unicode_literals, division, absolute_import, print_function)
+
+import os
+import sys
+
+from time import sleep
+from subprocess import check_call
+from glob import glob1
+from traceback import print_exc
+
+from powerline.lib.dict import updated
+
+from tests.modules.lib.terminal import (ExpectProcess, MutableDimensions,
+ do_terminal_tests, get_env)
+from tests.modules import PowerlineTestSuite
+
+
+TEST_ROOT = os.path.abspath(os.environ['TEST_ROOT'])
+
+
+def main(attempts=3):
+ vterm_path = os.path.join(TEST_ROOT, 'path')
+
+ vim_exe = os.path.join(vterm_path, 'vim')
+
+ env = get_env(vterm_path, TEST_ROOT)
+ env['ROOT'] = os.path.abspath('.')
+
+ dim = MutableDimensions(rows=50, cols=200)
+
+ vimrc = os.path.join(TEST_ROOT, 'init.vim')
+ vimrc_contents = '''
+ set laststatus=2
+ set runtimepath=$ROOT/powerline/bindings/vim
+ '''
+ with open(vimrc, 'w') as vd:
+ vd.write(vimrc_contents)
+
+ base_attrs = {
+ (( 64, 64, 255), (0, 0, 0), 0, 0, 0): 'NT', # NonText
+ ((240, 240, 240), (0, 0, 0), 0, 0, 0): 'N', # Normal
+ }
+
+ args = [
+ '-u', vimrc,
+ '-i', 'NONE',
+ ]
+
+ def feed(p):
+ p.send(':echo strtrans(eval(&statusline[2:]))\n')
+
+ tests = (
+ )
+
+ with PowerlineTestSuite('vim') as suite:
+ return do_terminal_tests(
+ tests=tests,
+ cmd=vim_exe,
+ dim=dim,
+ args=args,
+ env=env,
+ cwd=TEST_ROOT,
+ suite=suite,
+ )
+
+
+if __name__ == '__main__':
+ if main():
+ raise SystemExit(0)
+ else:
+ raise SystemExit(1)