2017-07-06 23:57:50 -07:00
|
|
|
" Tests for startup using utf-8.
|
|
|
|
|
2021-06-13 09:26:34 -07:00
|
|
|
source check.vim
|
2017-07-06 23:57:50 -07:00
|
|
|
source shared.vim
|
2020-04-28 20:13:23 -07:00
|
|
|
source screendump.vim
|
2017-07-06 23:57:50 -07:00
|
|
|
|
|
|
|
func Test_read_stdin_utf8()
|
|
|
|
let linesin = ['テスト', '€ÀÈÌÒÙ']
|
2024-07-16 18:24:52 -07:00
|
|
|
call writefile(linesin, 'Xtestin', 'D')
|
2017-07-06 23:57:50 -07:00
|
|
|
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
|
2024-07-16 18:24:52 -07:00
|
|
|
|
2017-07-06 23:57:50 -07:00
|
|
|
call delete('Xtestout')
|
|
|
|
endfunc
|
|
|
|
|
|
|
|
func Test_read_fifo_utf8()
|
2024-07-16 18:24:52 -07:00
|
|
|
CheckUnix
|
2017-07-06 23:57:50 -07:00
|
|
|
" Using bash/zsh's process substitution.
|
|
|
|
if executable('bash')
|
|
|
|
set shell=bash
|
|
|
|
elseif executable('zsh')
|
|
|
|
set shell=zsh
|
|
|
|
else
|
2024-07-16 18:24:52 -07:00
|
|
|
throw 'Skipped: bash or zsh is required'
|
2017-07-06 23:57:50 -07:00
|
|
|
endif
|
|
|
|
let linesin = ['テスト', '€ÀÈÌÒÙ']
|
2024-07-16 18:24:52 -07:00
|
|
|
call writefile(linesin, 'Xtestin', 'D')
|
2017-07-06 23:57:50 -07:00
|
|
|
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
|
2024-07-16 18:24:52 -07:00
|
|
|
|
2017-07-06 23:57:50 -07:00
|
|
|
call delete('Xtestout')
|
|
|
|
endfunc
|
2019-02-17 19:46:42 -07:00
|
|
|
|
|
|
|
func Test_detect_ambiwidth()
|
2022-11-04 17:07:06 -07:00
|
|
|
CheckRunVimInTerminal
|
2019-02-17 19:46:42 -07:00
|
|
|
|
|
|
|
" 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',
|
2024-07-16 18:24:52 -07:00
|
|
|
\ ], 'Xscript', 'D')
|
2021-06-13 09:26:34 -07:00
|
|
|
let buf = RunVimInTerminal('-S Xscript', #{keep_t_u7: 1})
|
2023-08-20 23:59:52 -07:00
|
|
|
call TermWait(buf)
|
2019-02-17 19:46:42 -07:00
|
|
|
call term_sendkeys(buf, "S\<C-R>=&ambiwidth\<CR>\<Esc>")
|
|
|
|
call WaitForAssert({-> assert_match('single', term_getline(buf, 1))})
|
|
|
|
|
|
|
|
call StopVimInTerminal(buf)
|
|
|
|
endfunc
|
2024-07-16 18:24:52 -07:00
|
|
|
|
|
|
|
" vim: shiftwidth=2 sts=2 expandtab
|