robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
72eb9fe87c
master
1" Tests for startup using utf-8. 2 3source check.vim 4source shared.vim 5source screendump.vim 6 7func Test_read_stdin_utf8 () 8let linesin = [ 'テスト' , '€ÀÈÌÒÙ' ] 9call writefile ( linesin , 'Xtestin' , 'D' ) 10let before = [ 11 \'set enc=utf-8' , 12 \'set fencs=cp932,utf-8' , 13 \] 14let after = [ 15 \'write ++enc=utf-8 Xtestout' , 16 \'quit!' , 17 \] 18if has ( 'win32' ) 19let pipecmd = 'type Xtestin | ' 20else 21let pipecmd = 'cat Xtestin | ' 22endif 23if RunVimPiped ( before , after , '-' , pipecmd ) 24let lines = readfile ( 'Xtestout' ) 25call assert_equal ( linesin , lines ) 26else 27call assert_equal ( '' , 'RunVimPiped failed.' ) 28endif 29 30call delete ( 'Xtestout' ) 31endfunc 32 33func Test_read_fifo_utf8 () 34CheckUnix 35" Using bash/zsh's process substitution. 36if executable ( 'bash' ) 37set shell = bash 38elseif executable ( 'zsh' ) 39set shell = zsh 40else 41throw 'Skipped: bash or zsh is required' 42endif 43let linesin = [ 'テスト' , '€ÀÈÌÒÙ' ] 44call writefile ( linesin , 'Xtestin' , 'D' ) 45let before = [ 46 \'set enc=utf-8' , 47 \'set fencs=cp932,utf-8' , 48 \] 49let after = [ 50 \'write ++enc=utf-8 Xtestout' , 51 \'quit!' , 52 \] 53if RunVim ( before , after , '<(cat Xtestin)' ) 54let lines = readfile ( 'Xtestout' ) 55call assert_equal ( linesin , lines ) 56else 57call assert_equal ( '' , 'RunVim failed.' ) 58endif 59 60call delete ( 'Xtestout' ) 61endfunc 62 63func Test_detect_fifo () 64CheckUnix 65" On OpenBSD /dev/fd/n files are character special, not FIFO 66CheckNotOpenBSD 67" Using bash/zsh's process substitution. 68if executable ( 'bash' ) 69set shell = bash 70elseif executable ( 'zsh' ) 71set shell = zsh 72else 73throw 'Skipped: bash or zsh is required' 74endif 75let linesin = [ 'one' , 'two' ] 76call writefile ( linesin , 'Xtestin_fifo' , 'D' ) 77let after = [ 78 \'call writefile(split(execute(":mess"), "\\n"), "Xtestout")' , 79 \'quit!' , 80 \] 81" if RunVim([], after, '<(cat Xtestin_fifo)') 82if RunVim ([ 'set shortmess-=F' ], after , '<(cat Xtestin_fifo)' ) 83let lines = readfile ( 'Xtestout' ) 84call assert_match ( '\[fifo\]' , lines [ 0 ]) 85" call assert_match('\[fifo\]', lines[1]) 86else 87call assert_equal ( '' , 'RunVim failed.' ) 88endif 89 90call delete ( 'Xtestout' ) 91endfunc 92 93func Test_detect_ambiwidth () 94CheckRunVimInTerminal 95 96" Use the title termcap entries to output the escape sequence. 97call writefile ([ 98 \'set enc=utf-8' , 99 \'set ambiwidth=double' , 100 \'call test_option_not_set("ambiwidth")' , 101 \'redraw' , 102 \], 'Xscript' , 'D' ) 103let buf = RunVimInTerminal ( '-S Xscript' , #{ keep_t_u7 : 1 }) 104call TermWait ( buf ) 105call term_sendkeys ( buf , "S\<C-R>=&ambiwidth\<CR>\<Esc>" ) 106call WaitForAssert ({ ->assert_match ( 'single' , term_getline ( buf , 1 ))}) 107 108call StopVimInTerminal ( buf ) 109endfunc 110 111" vim: shiftwidth=2 sts=2 expandtab