Skip to content

Commit 1f33e0a

Browse files
committed
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 #7490
1 parent 8e7d622 commit 1f33e0a

2 files changed

Lines changed: 49 additions & 0 deletions

File tree

src/testdir/test_startup.vim

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,53 @@ func Test_t_arg()
741741
call delete('Xfile1')
742742
endfunc
743743

744+
" Test the '-T' argument which sets the 'term' option.
745+
func Test_T_arg()
746+
CheckNotGui
747+
let after =<< trim [CODE]
748+
call writefile([&term], "Xtest_T_arg")
749+
qall
750+
[CODE]
751+
752+
for t in ['builtin_dumb', 'builtin_ansi']
753+
if RunVim([], after, '-T ' .. t)
754+
let lines = readfile('Xtest_T_arg')
755+
call assert_equal([t], lines)
756+
endif
757+
endfor
758+
759+
call delete('Xtest_T_arg')
760+
endfunc
761+
762+
" Test the '-x' argument to read/write encrypted files.
763+
func Test_x_arg()
764+
CheckRunVimInTerminal
765+
CheckFeature cryptv
766+
767+
" Create an encrypted file Xtest_x_arg.
768+
let buf = RunVimInTerminal('-n -x Xtest_x_arg', #{rows: 10, wait_for_ruler: 0})
769+
call WaitForAssert({-> assert_match('^Enter encryption key: ', term_getline(buf, 10))})
770+
call term_sendkeys(buf, "foo\n")
771+
call WaitForAssert({-> assert_match('^Enter same key again: ', term_getline(buf, 10))})
772+
call term_sendkeys(buf, "foo\n")
773+
call WaitForAssert({-> assert_match(' All$', term_getline(buf, 10))})
774+
call term_sendkeys(buf, "itest\<Esc>:w\<Enter>")
775+
call WaitForAssert({-> assert_match('"Xtest_x_arg" \[New\]\[blowfish2\] 1L, 5B written',
776+
\ term_getline(buf, 10))})
777+
call StopVimInTerminal(buf)
778+
779+
" Read the encrypted file and check that it contains the expected content "test"
780+
let buf = RunVimInTerminal('-n -x Xtest_x_arg', #{rows: 10, wait_for_ruler: 0})
781+
call WaitForAssert({-> assert_match('^Enter encryption key: ', term_getline(buf, 10))})
782+
call term_sendkeys(buf, "foo\n")
783+
call WaitForAssert({-> assert_match('^Enter same key again: ', term_getline(buf, 10))})
784+
call term_sendkeys(buf, "foo\n")
785+
call WaitForAssert({-> assert_match('^test', term_getline(buf, 1))})
786+
call StopVimInTerminal(buf)
787+
788+
call delete('Xtest_x_arg')
789+
endfunc
790+
744791
" Test for entering the insert mode on startup
745792
func Test_start_insertmode()
746793
let before =<< trim [CODE]

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,8 @@ static char *(features[]) =
750750

751751
static int included_patches[] =
752752
{ /* Add new patch number below this line */
753+
/**/
754+
2161,
753755
/**/
754756
2160,
755757
/**/

0 commit comments

Comments
 (0)