@@ -741,6 +741,53 @@ func Test_t_arg()
741741 call delete (' Xfile1' )
742742endfunc
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
745792func Test_start_insertmode ()
746793 let before = << trim [CODE]
0 commit comments