@@ -1049,24 +1049,131 @@ func Test_terminal_dumpdiff_options()
10491049 set laststatus &
10501050endfunc
10511051
1052- func Test_terminal_api_drop_newwin ()
1053- if ! CanRunVimInTerminal ()
1054- return
1055- endif
1052+ func Api_drop_common (options )
10561053 call assert_equal (1 , winnr (' $' ))
10571054
10581055 " Use the title termcap entries to output the escape sequence.
10591056 call writefile ([
10601057 \ ' set title' ,
10611058 \ ' exe "set t_ts=\<Esc>]51; t_fs=\x07"' ,
1062- \ ' let &titlestring = '' ["drop","Xtextfile"]'' ' ,
1059+ \ ' let &titlestring = '' ["drop","Xtextfile"' . a: options . ' ]'' ' ,
10631060 \ ' redraw' ,
10641061 \ " set t_ts=" ,
10651062 \ ], ' Xscript' )
10661063 let buf = RunVimInTerminal (' -S Xscript' , {})
10671064 call WaitFor ({- > bufnr (' Xtextfile' ) > 0 })
10681065 call assert_equal (' Xtextfile' , expand (' %:t' ))
10691066 call assert_true (winnr (' $' ) >= 3 )
1067+ return buf
1068+ endfunc
1069+
1070+ func Test_terminal_api_drop_newwin ()
1071+ if ! CanRunVimInTerminal ()
1072+ return
1073+ endif
1074+ let buf = Api_drop_common (' ' )
1075+ call assert_equal (0 , &bin )
1076+ call assert_equal (' ' , &fenc )
1077+
1078+ call StopVimInTerminal (buf )
1079+ call delete (' Xscript' )
1080+ bwipe Xtextfile
1081+ endfunc
1082+
1083+ func Test_terminal_api_drop_newwin_bin ()
1084+ if ! CanRunVimInTerminal ()
1085+ return
1086+ endif
1087+ let buf = Api_drop_common (' ,{"bin":1}' )
1088+ call assert_equal (1 , &bin )
1089+
1090+ call StopVimInTerminal (buf )
1091+ call delete (' Xscript' )
1092+ bwipe Xtextfile
1093+ endfunc
1094+
1095+ func Test_terminal_api_drop_newwin_binary ()
1096+ if ! CanRunVimInTerminal ()
1097+ return
1098+ endif
1099+ let buf = Api_drop_common (' ,{"binary":1}' )
1100+ call assert_equal (1 , &bin )
1101+
1102+ call StopVimInTerminal (buf )
1103+ call delete (' Xscript' )
1104+ bwipe Xtextfile
1105+ endfunc
1106+
1107+ func Test_terminal_api_drop_newwin_nobin ()
1108+ if ! CanRunVimInTerminal ()
1109+ return
1110+ endif
1111+ set binary
1112+ let buf = Api_drop_common (' ,{"nobin":1}' )
1113+ call assert_equal (0 , &bin )
1114+
1115+ call StopVimInTerminal (buf )
1116+ call delete (' Xscript' )
1117+ bwipe Xtextfile
1118+ set nobinary
1119+ endfunc
1120+
1121+ func Test_terminal_api_drop_newwin_nobinary ()
1122+ if ! CanRunVimInTerminal ()
1123+ return
1124+ endif
1125+ set binary
1126+ let buf = Api_drop_common (' ,{"nobinary":1}' )
1127+ call assert_equal (0 , &bin )
1128+
1129+ call StopVimInTerminal (buf )
1130+ call delete (' Xscript' )
1131+ bwipe Xtextfile
1132+ set nobinary
1133+ endfunc
1134+
1135+ func Test_terminal_api_drop_newwin_ff ()
1136+ if ! CanRunVimInTerminal ()
1137+ return
1138+ endif
1139+ let buf = Api_drop_common (' ,{"ff":"dos"}' )
1140+ call assert_equal (" dos" , &ff )
1141+
1142+ call StopVimInTerminal (buf )
1143+ call delete (' Xscript' )
1144+ bwipe Xtextfile
1145+ endfunc
1146+
1147+ func Test_terminal_api_drop_newwin_fileformat ()
1148+ if ! CanRunVimInTerminal ()
1149+ return
1150+ endif
1151+ let buf = Api_drop_common (' ,{"fileformat":"dos"}' )
1152+ call assert_equal (" dos" , &ff )
1153+
1154+ call StopVimInTerminal (buf )
1155+ call delete (' Xscript' )
1156+ bwipe Xtextfile
1157+ endfunc
1158+
1159+ func Test_terminal_api_drop_newwin_enc ()
1160+ if ! CanRunVimInTerminal ()
1161+ return
1162+ endif
1163+ let buf = Api_drop_common (' ,{"enc":"utf-16"}' )
1164+ call assert_equal (" utf-16" , &fenc )
1165+
1166+ call StopVimInTerminal (buf )
1167+ call delete (' Xscript' )
1168+ bwipe Xtextfile
1169+ endfunc
1170+
1171+ func Test_terminal_api_drop_newwin_encoding ()
1172+ if ! CanRunVimInTerminal ()
1173+ return
1174+ endif
1175+ let buf = Api_drop_common (' ,{"encoding":"utf-16"}' )
1176+ call assert_equal (" utf-16" , &fenc )
10701177
10711178 call StopVimInTerminal (buf )
10721179 call delete (' Xscript' )
0 commit comments