comparison src/testdir/test_terminal.vim @ 13575:4df23d9bad47 v8.0.1660

patch 8.0.1660: the terminal API "drop" command doesn't support options commit https://github.com/vim/vim/commit/333b80acf3a44e462456e6d5730e47ffa449c83d Author: Bram Moolenaar <Bram@vim.org> Date: Wed Apr 4 22:57:29 2018 +0200 patch 8.0.1660: the terminal API "drop" command doesn't support options Problem: The terminal API "drop" command doesn't support options. Solution: Implement the options.
author Christian Brabandt <cb@256bit.org>
date Wed, 04 Apr 2018 23:00:07 +0200
parents af68603e213d
children 18c10f37ac5e
comparison
equal deleted inserted replaced
13574:73c69063091f 13575:4df23d9bad47
1047 bwipe 1047 bwipe
1048 1048
1049 set laststatus& 1049 set laststatus&
1050 endfunc 1050 endfunc
1051 1051
1052 func Test_terminal_api_drop_newwin() 1052 func Api_drop_common(options)
1053 if !CanRunVimInTerminal()
1054 return
1055 endif
1056 call assert_equal(1, winnr('$')) 1053 call assert_equal(1, winnr('$'))
1057 1054
1058 " Use the title termcap entries to output the escape sequence. 1055 " Use the title termcap entries to output the escape sequence.
1059 call writefile([ 1056 call writefile([
1060 \ 'set title', 1057 \ 'set title',
1061 \ 'exe "set t_ts=\<Esc>]51; t_fs=\x07"', 1058 \ 'exe "set t_ts=\<Esc>]51; t_fs=\x07"',
1062 \ 'let &titlestring = ''["drop","Xtextfile"]''', 1059 \ 'let &titlestring = ''["drop","Xtextfile"' . a:options . ']''',
1063 \ 'redraw', 1060 \ 'redraw',
1064 \ "set t_ts=", 1061 \ "set t_ts=",
1065 \ ], 'Xscript') 1062 \ ], 'Xscript')
1066 let buf = RunVimInTerminal('-S Xscript', {}) 1063 let buf = RunVimInTerminal('-S Xscript', {})
1067 call WaitFor({-> bufnr('Xtextfile') > 0}) 1064 call WaitFor({-> bufnr('Xtextfile') > 0})
1068 call assert_equal('Xtextfile', expand('%:t')) 1065 call assert_equal('Xtextfile', expand('%:t'))
1069 call assert_true(winnr('$') >= 3) 1066 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)
1070 1177
1071 call StopVimInTerminal(buf) 1178 call StopVimInTerminal(buf)
1072 call delete('Xscript') 1179 call delete('Xscript')
1073 bwipe Xtextfile 1180 bwipe Xtextfile
1074 endfunc 1181 endfunc