blob: 49fb9d8a9fa60914d83dc7716489ccf7538b553b [file] [log] [blame]
Bram Moolenaar617d7ef2019-01-17 13:04:30 +01001" Test for setting 'encoding' to something else than the terminal uses, then
2" setting 'termencoding' to make it work.
3
4" This only works with "iconv".
Bram Moolenaar30276f22019-01-24 17:59:39 +01005if !has('iconv')
Bram Moolenaar5d30ff12019-06-06 16:12:12 +02006 throw 'Skipped: iconv feature missing'
Bram Moolenaar617d7ef2019-01-17 13:04:30 +01007endif
8
9source screendump.vim
10if !CanRunVimInTerminal()
Bram Moolenaar5d30ff12019-06-06 16:12:12 +020011 throw 'Skipped: cannot make screendumps'
Bram Moolenaar617d7ef2019-01-17 13:04:30 +010012endif
13
14" This Vim is running with 'encoding' "utf-8", the Vim in the terminal is
15" running with 'encoding' "euc-jp". We need to make sure the text is in the
16" right encoding, this is a bit tricky.
17func Test_termencoding_euc_jp()
18 new
19 call setline(1, 'E89: バッファ %ld の変更は保存されていません (! で変更を破棄)')
20 write ++enc=euc-jp Xeuc_jp.txt
21 quit
22
23 call writefile([
24 \ 'set encoding=euc-jp',
25 \ 'set termencoding=utf-8',
26 \ 'scriptencoding utf-8',
27 \ 'exe "normal aE83: バッファを作成できないので、他のを使用します...\<Esc>"',
28 \ 'split Xeuc_jp.txt',
29 \ ], 'XTest_tenc_euc_jp')
30 let buf = RunVimInTerminal('-S XTest_tenc_euc_jp', {'rows': 10})
31 call VerifyScreenDump(buf, 'Test_tenc_euc_jp_01', {})
32
33 " clean up
34 call StopVimInTerminal(buf)
35 call delete('Xeuc_jp.txt')
36 call delete('XTest_tenc_euc_jp')
37endfunc