mirror of
https://github.com/neovim/neovim.git
synced 2024-12-26 14:11:15 -07:00
ff801ce7f7
Problem: Tests using term_wait() can still be flaky.
Solution: Increase the wait time when rerunning a test. (James McCoy,
closes vim/vim#5899) Halve the initial times to make tests run faster
when there is no rerun.
6a2c5a7dd5
Co-authored-by: Bram Moolenaar <Bram@vim.org>
83 lines
1.9 KiB
VimL
83 lines
1.9 KiB
VimL
" Tests for startup using utf-8.
|
|
|
|
source check.vim
|
|
source shared.vim
|
|
source screendump.vim
|
|
|
|
func Test_read_stdin_utf8()
|
|
let linesin = ['テスト', '€ÀÈÌÒÙ']
|
|
call writefile(linesin, 'Xtestin')
|
|
let before = [
|
|
\ 'set enc=utf-8',
|
|
\ 'set fencs=cp932,utf-8',
|
|
\ ]
|
|
let after = [
|
|
\ 'write ++enc=utf-8 Xtestout',
|
|
\ 'quit!',
|
|
\ ]
|
|
if has('win32')
|
|
let pipecmd = 'type Xtestin | '
|
|
else
|
|
let pipecmd = 'cat Xtestin | '
|
|
endif
|
|
if RunVimPiped(before, after, '-', pipecmd)
|
|
let lines = readfile('Xtestout')
|
|
call assert_equal(linesin, lines)
|
|
else
|
|
call assert_equal('', 'RunVimPiped failed.')
|
|
endif
|
|
call delete('Xtestout')
|
|
call delete('Xtestin')
|
|
endfunc
|
|
|
|
func Test_read_fifo_utf8()
|
|
if !has('unix')
|
|
return
|
|
endif
|
|
" Using bash/zsh's process substitution.
|
|
if executable('bash')
|
|
set shell=bash
|
|
elseif executable('zsh')
|
|
set shell=zsh
|
|
else
|
|
return
|
|
endif
|
|
let linesin = ['テスト', '€ÀÈÌÒÙ']
|
|
call writefile(linesin, 'Xtestin')
|
|
let before = [
|
|
\ 'set enc=utf-8',
|
|
\ 'set fencs=cp932,utf-8',
|
|
\ ]
|
|
let after = [
|
|
\ 'write ++enc=utf-8 Xtestout',
|
|
\ 'quit!',
|
|
\ ]
|
|
if RunVim(before, after, '<(cat Xtestin)')
|
|
let lines = readfile('Xtestout')
|
|
call assert_equal(linesin, lines)
|
|
else
|
|
call assert_equal('', 'RunVim failed.')
|
|
endif
|
|
call delete('Xtestout')
|
|
call delete('Xtestin')
|
|
endfunc
|
|
|
|
func Test_detect_ambiwidth()
|
|
CheckRunVimInTerminal
|
|
|
|
" Use the title termcap entries to output the escape sequence.
|
|
call writefile([
|
|
\ 'set enc=utf-8',
|
|
\ 'set ambiwidth=double',
|
|
\ 'call test_option_not_set("ambiwidth")',
|
|
\ 'redraw',
|
|
\ ], 'Xscript')
|
|
let buf = RunVimInTerminal('-S Xscript', #{keep_t_u7: 1})
|
|
call TermWait(buf)
|
|
call term_sendkeys(buf, "S\<C-R>=&ambiwidth\<CR>\<Esc>")
|
|
call WaitForAssert({-> assert_match('single', term_getline(buf, 1))})
|
|
|
|
call StopVimInTerminal(buf)
|
|
call delete('Xscript')
|
|
endfunc
|