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