annotate src/testdir/test_startup_utf8.vim @ 31029:bf8e9ef40006 v9.0.0849

patch 9.0.0849: terminal mouse test is a bit flaky Commit: https://github.com/vim/vim/commit/157241e8798fe1c14f3787ee341ffee2c403714a Author: James McCoy <jamessan@jamessan.com> Date: Wed Nov 9 23:29:14 2022 +0000 patch 9.0.0849: terminal mouse test is a bit flaky Problem: Terminal mouse test is a bit flaky. Solution: Add WaitFor() calls. (James McCoy closes https://github.com/vim/vim/issues/11519) Tune wait times to reduce flakiness.
author Bram Moolenaar <Bram@vim.org>
date Thu, 10 Nov 2022 00:30:04 +0100
parents ae10b91ac6b3
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9828
e84e45786691 commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Tests for startup using utf-8.
e84e45786691 commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
20768
1e2e81dbb958 patch 8.2.0936: some terminals misinterpret the code for getting cursor style
Bram Moolenaar <Bram@vim.org>
parents: 20625
diff changeset
3 source check.vim
9828
e84e45786691 commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 source shared.vim
14750
1e6666885bc0 patch 8.1.0387: no test for 'ambiwidth' detection
Christian Brabandt <cb@256bit.org>
parents: 9828
diff changeset
5 source screendump.vim
9828
e84e45786691 commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6
e84e45786691 commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 func Test_read_stdin_utf8()
e84e45786691 commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 let linesin = ['テスト', '€ÀÈÌÒÙ']
30769
ae10b91ac6b3 patch 9.0.0719: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
9 call writefile(linesin, 'Xtestin', 'D')
9828
e84e45786691 commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 let before = [
e84e45786691 commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 \ 'set enc=utf-8',
e84e45786691 commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 \ 'set fencs=cp932,utf-8',
e84e45786691 commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 \ ]
e84e45786691 commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 let after = [
e84e45786691 commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 \ 'write ++enc=utf-8 Xtestout',
e84e45786691 commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 \ 'quit!',
e84e45786691 commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 \ ]
e84e45786691 commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 if has('win32')
e84e45786691 commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 let pipecmd = 'type Xtestin | '
e84e45786691 commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 else
e84e45786691 commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 let pipecmd = 'cat Xtestin | '
e84e45786691 commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 endif
e84e45786691 commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 if RunVimPiped(before, after, '-', pipecmd)
e84e45786691 commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 let lines = readfile('Xtestout')
e84e45786691 commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 call assert_equal(linesin, lines)
e84e45786691 commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 else
e84e45786691 commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 call assert_equal('', 'RunVimPiped failed.')
e84e45786691 commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28 endif
30769
ae10b91ac6b3 patch 9.0.0719: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
29
9828
e84e45786691 commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 call delete('Xtestout')
e84e45786691 commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31 endfunc
e84e45786691 commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32
e84e45786691 commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 func Test_read_fifo_utf8()
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 20768
diff changeset
34 CheckUnix
9828
e84e45786691 commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35 " Using bash/zsh's process substitution.
e84e45786691 commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36 if executable('bash')
e84e45786691 commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37 set shell=bash
e84e45786691 commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
38 elseif executable('zsh')
e84e45786691 commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
39 set shell=zsh
e84e45786691 commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40 else
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 20768
diff changeset
41 throw 'Skipped: bash or zsh is required'
9828
e84e45786691 commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42 endif
e84e45786691 commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43 let linesin = ['テスト', '€ÀÈÌÒÙ']
30769
ae10b91ac6b3 patch 9.0.0719: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
44 call writefile(linesin, 'Xtestin', 'D')
9828
e84e45786691 commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45 let before = [
e84e45786691 commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
46 \ 'set enc=utf-8',
e84e45786691 commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
47 \ 'set fencs=cp932,utf-8',
e84e45786691 commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
48 \ ]
e84e45786691 commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
49 let after = [
e84e45786691 commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
50 \ 'write ++enc=utf-8 Xtestout',
e84e45786691 commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
51 \ 'quit!',
e84e45786691 commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
52 \ ]
e84e45786691 commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
53 if RunVim(before, after, '<(cat Xtestin)')
e84e45786691 commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
54 let lines = readfile('Xtestout')
e84e45786691 commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
55 call assert_equal(linesin, lines)
e84e45786691 commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
56 else
e84e45786691 commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
57 call assert_equal('', 'RunVim failed.')
e84e45786691 commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
58 endif
30769
ae10b91ac6b3 patch 9.0.0719: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
59
9828
e84e45786691 commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
60 call delete('Xtestout')
e84e45786691 commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
61 endfunc
14750
1e6666885bc0 patch 8.1.0387: no test for 'ambiwidth' detection
Christian Brabandt <cb@256bit.org>
parents: 9828
diff changeset
62
1e6666885bc0 patch 8.1.0387: no test for 'ambiwidth' detection
Christian Brabandt <cb@256bit.org>
parents: 9828
diff changeset
63 func Test_detect_ambiwidth()
20625
116c7bd5e980 patch 8.2.0866: not enough tests for buffer writing
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
64 CheckRunVimInTerminal
14750
1e6666885bc0 patch 8.1.0387: no test for 'ambiwidth' detection
Christian Brabandt <cb@256bit.org>
parents: 9828
diff changeset
65
1e6666885bc0 patch 8.1.0387: no test for 'ambiwidth' detection
Christian Brabandt <cb@256bit.org>
parents: 9828
diff changeset
66 " Use the title termcap entries to output the escape sequence.
1e6666885bc0 patch 8.1.0387: no test for 'ambiwidth' detection
Christian Brabandt <cb@256bit.org>
parents: 9828
diff changeset
67 call writefile([
1e6666885bc0 patch 8.1.0387: no test for 'ambiwidth' detection
Christian Brabandt <cb@256bit.org>
parents: 9828
diff changeset
68 \ 'set enc=utf-8',
1e6666885bc0 patch 8.1.0387: no test for 'ambiwidth' detection
Christian Brabandt <cb@256bit.org>
parents: 9828
diff changeset
69 \ 'set ambiwidth=double',
1e6666885bc0 patch 8.1.0387: no test for 'ambiwidth' detection
Christian Brabandt <cb@256bit.org>
parents: 9828
diff changeset
70 \ 'call test_option_not_set("ambiwidth")',
1e6666885bc0 patch 8.1.0387: no test for 'ambiwidth' detection
Christian Brabandt <cb@256bit.org>
parents: 9828
diff changeset
71 \ 'redraw',
30769
ae10b91ac6b3 patch 9.0.0719: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
72 \ ], 'Xscript', 'D')
20768
1e2e81dbb958 patch 8.2.0936: some terminals misinterpret the code for getting cursor style
Bram Moolenaar <Bram@vim.org>
parents: 20625
diff changeset
73 let buf = RunVimInTerminal('-S Xscript', #{keep_t_u7: 1})
19954
c087099e9163 patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
74 call TermWait(buf)
14750
1e6666885bc0 patch 8.1.0387: no test for 'ambiwidth' detection
Christian Brabandt <cb@256bit.org>
parents: 9828
diff changeset
75 call term_sendkeys(buf, "S\<C-R>=&ambiwidth\<CR>\<Esc>")
1e6666885bc0 patch 8.1.0387: no test for 'ambiwidth' detection
Christian Brabandt <cb@256bit.org>
parents: 9828
diff changeset
76 call WaitForAssert({-> assert_match('single', term_getline(buf, 1))})
1e6666885bc0 patch 8.1.0387: no test for 'ambiwidth' detection
Christian Brabandt <cb@256bit.org>
parents: 9828
diff changeset
77
1e6666885bc0 patch 8.1.0387: no test for 'ambiwidth' detection
Christian Brabandt <cb@256bit.org>
parents: 9828
diff changeset
78 call StopVimInTerminal(buf)
1e6666885bc0 patch 8.1.0387: no test for 'ambiwidth' detection
Christian Brabandt <cb@256bit.org>
parents: 9828
diff changeset
79 endfunc
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 20768
diff changeset
80
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 20768
diff changeset
81 " vim: shiftwidth=2 sts=2 expandtab