annotate src/testdir/test_startup_utf8.vim @ 30594:586b5b3aacf9 v9.0.0632

patch 9.0.0632: calling a function from an "expr" option has overhead Commit: https://github.com/vim/vim/commit/87b4e5c5db9d1cfd6f2e79656e1a6cff3c69d15f Author: Bram Moolenaar <Bram@vim.org> Date: Sat Oct 1 15:32:46 2022 +0100 patch 9.0.0632: calling a function from an "expr" option has overhead Problem: Calling a function from an "expr" option has too much overhead. Solution: Add call_simple_func() and use it for 'foldexpr'
author Bram Moolenaar <Bram@vim.org>
date Sat, 01 Oct 2022 16:45:04 +0200
parents 08940efa6b4e
children ae10b91ac6b3
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 = ['テスト', '€ÀÈÌÒÙ']
e84e45786691 commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 call writefile(linesin, 'Xtestin')
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
e84e45786691 commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 call delete('Xtestout')
e84e45786691 commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 call delete('Xtestin')
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 = ['テスト', '€ÀÈÌÒÙ']
e84e45786691 commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44 call writefile(linesin, 'Xtestin')
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
e84e45786691 commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
59 call delete('Xtestout')
e84e45786691 commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
60 call delete('Xtestin')
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',
1e6666885bc0 patch 8.1.0387: no test for 'ambiwidth' detection
Christian Brabandt <cb@256bit.org>
parents: 9828
diff changeset
72 \ ], 'Xscript')
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 call delete('Xscript')
1e6666885bc0 patch 8.1.0387: no test for 'ambiwidth' detection
Christian Brabandt <cb@256bit.org>
parents: 9828
diff changeset
80 endfunc
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 20768
diff changeset
81
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 20768
diff changeset
82 " vim: shiftwidth=2 sts=2 expandtab