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