1" Tests for startup using utf-8. 2 3source shared.vim 4source screendump.vim 5 6func Test_read_stdin_utf8() 7 let linesin = ['テスト', '€ÀÈÌÒÙ'] 8 call writefile(linesin, 'Xtestin') 9 let before = [ 10 \ 'set enc=utf-8', 11 \ 'set fencs=cp932,utf-8', 12 \ ] 13 let after = [ 14 \ 'write ++enc=utf-8 Xtestout', 15 \ 'quit!', 16 \ ] 17 if has('win32') 18 let pipecmd = 'type Xtestin | ' 19 else 20 let pipecmd = 'cat Xtestin | ' 21 endif 22 if RunVimPiped(before, after, '-', pipecmd) 23 let lines = readfile('Xtestout') 24 call assert_equal(linesin, lines) 25 else 26 call assert_equal('', 'RunVimPiped failed.') 27 endif 28 call delete('Xtestout') 29 call delete('Xtestin') 30endfunc 31 32func Test_read_fifo_utf8() 33 if !has('unix') 34 return 35 endif 36 " Using bash/zsh's process substitution. 37 if executable('bash') 38 set shell=bash 39 elseif executable('zsh') 40 set shell=zsh 41 else 42 return 43 endif 44 let linesin = ['テスト', '€ÀÈÌÒÙ'] 45 call writefile(linesin, 'Xtestin') 46 let before = [ 47 \ 'set enc=utf-8', 48 \ 'set fencs=cp932,utf-8', 49 \ ] 50 let after = [ 51 \ 'write ++enc=utf-8 Xtestout', 52 \ 'quit!', 53 \ ] 54 if RunVim(before, after, '<(cat Xtestin)') 55 let lines = readfile('Xtestout') 56 call assert_equal(linesin, lines) 57 else 58 call assert_equal('', 'RunVim failed.') 59 endif 60 call delete('Xtestout') 61 call delete('Xtestin') 62endfunc 63 64func Test_detect_ambiwidth() 65 if !CanRunVimInTerminal() 66 throw 'Skipped: cannot run Vim in a terminal window' 67 endif 68 69 " Use the title termcap entries to output the escape sequence. 70 call writefile([ 71 \ 'set enc=utf-8', 72 \ 'set ambiwidth=double', 73 \ 'call test_option_not_set("ambiwidth")', 74 \ 'redraw', 75 \ ], 'Xscript') 76 let buf = RunVimInTerminal('-S Xscript', {}) 77 call TermWait(buf) 78 call term_sendkeys(buf, "S\<C-R>=&ambiwidth\<CR>\<Esc>") 79 call WaitForAssert({-> assert_match('single', term_getline(buf, 1))}) 80 81 call StopVimInTerminal(buf) 82 call delete('Xscript') 83endfunc 84