diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2020-12-19 21:21:04 -0500 |
---|---|---|
committer | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2020-12-19 21:30:12 -0500 |
commit | 6ee8964d464af49980f9ebbad2dc51607b2d4f5d (patch) | |
tree | 92e149a0230dc3f8b6aeb41e6da735efad934a71 /src | |
parent | 7e4c912565f1dc00a873cff14ca435af9796cd4c (diff) | |
download | rneovim-6ee8964d464af49980f9ebbad2dc51607b2d4f5d.tar.gz rneovim-6ee8964d464af49980f9ebbad2dc51607b2d4f5d.tar.bz2 rneovim-6ee8964d464af49980f9ebbad2dc51607b2d4f5d.zip |
vim-patch:8.2.2161: arguments -T and -x not tested yet
Problem: Arguments -T and -x not tested yet.
Solution: Add a test. (Dominique Pellé, closes vim/vim#7490
https://github.com/vim/vim/commit/1f33e0a7c4cd278158b37f91a2aa44f0bcd1f21a
Neovim does not support '-T' command line argument so skip the test.
Ref a16eab9e57368188c834634cd824ce1ac5613db1
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/testdir/test_startup.vim | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_startup.vim b/src/nvim/testdir/test_startup.vim index 6214975ef5..e7f332bc4c 100644 --- a/src/nvim/testdir/test_startup.vim +++ b/src/nvim/testdir/test_startup.vim @@ -686,3 +686,53 @@ func Test_v_argv() call assert_true(idx > 2) call assert_equal(['arg1', '--cmd', 'echo v:argv', '--cmd', 'q'']'], list[idx:]) endfunc + +" Test the '-T' argument which sets the 'term' option. +func Test_T_arg() + throw 'skipped: Nvim does not support "-T" argument' + CheckNotGui + let after =<< trim [CODE] + call writefile([&term], "Xtest_T_arg") + qall + [CODE] + + for t in ['builtin_dumb', 'builtin_ansi'] + if RunVim([], after, '-T ' .. t) + let lines = readfile('Xtest_T_arg') + call assert_equal([t], lines) + endif + endfor + + call delete('Xtest_T_arg') +endfunc + +" Test the '-x' argument to read/write encrypted files. +func Test_x_arg() + CheckRunVimInTerminal + CheckFeature cryptv + + " Create an encrypted file Xtest_x_arg. + let buf = RunVimInTerminal('-n -x Xtest_x_arg', #{rows: 10, wait_for_ruler: 0}) + call WaitForAssert({-> assert_match('^Enter encryption key: ', term_getline(buf, 10))}) + call term_sendkeys(buf, "foo\n") + call WaitForAssert({-> assert_match('^Enter same key again: ', term_getline(buf, 10))}) + call term_sendkeys(buf, "foo\n") + call WaitForAssert({-> assert_match(' All$', term_getline(buf, 10))}) + call term_sendkeys(buf, "itest\<Esc>:w\<Enter>") + call WaitForAssert({-> assert_match('"Xtest_x_arg" \[New\]\[blowfish2\] 1L, 5B written', + \ term_getline(buf, 10))}) + call StopVimInTerminal(buf) + + " Read the encrypted file and check that it contains the expected content "test" + let buf = RunVimInTerminal('-n -x Xtest_x_arg', #{rows: 10, wait_for_ruler: 0}) + call WaitForAssert({-> assert_match('^Enter encryption key: ', term_getline(buf, 10))}) + call term_sendkeys(buf, "foo\n") + call WaitForAssert({-> assert_match('^Enter same key again: ', term_getline(buf, 10))}) + call term_sendkeys(buf, "foo\n") + call WaitForAssert({-> assert_match('^test', term_getline(buf, 1))}) + call StopVimInTerminal(buf) + + call delete('Xtest_x_arg') +endfunc + +" vim: shiftwidth=2 sts=2 expandtab |