robin/laufey

git clone https://git.robinwobin.dev/robin/laufey

zeertzjqvim-patch:partial:9.1.2137: test: Update tests for OpenBSD (#37766)72eb9fe87c

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