Mercurial > vim
annotate src/testdir/test_startup_utf8.vim @ 17694:6f9cde96ee3c v8.1.1844
patch 8.1.1844: buffer no longer unloaded when adding text properties
commit https://github.com/vim/vim/commit/45311b5274a6ac6e44235dfd4588c6b1bf0d4850
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Aug 13 22:27:32 2019 +0200
patch 8.1.1844: buffer no longer unloaded when adding text properties
Problem: Buffer no longer unloaded when adding text properties to it.
Solution: Do not create the memfile. (closes https://github.com/vim/vim/issues/4808)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 13 Aug 2019 22:30:06 +0200 |
parents | ba7727889385 |
children | c087099e9163 |
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 |
e84e45786691
commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3 source shared.vim |
14750
1e6666885bc0
patch 8.1.0387: no test for 'ambiwidth' detection
Christian Brabandt <cb@256bit.org>
parents:
9828
diff
changeset
|
4 source screendump.vim |
9828
e84e45786691
commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 |
e84e45786691
commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 func Test_read_stdin_utf8() |
e84e45786691
commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 let linesin = ['テスト', '€ÀÈÌÒÙ'] |
e84e45786691
commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 call writefile(linesin, 'Xtestin') |
e84e45786691
commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 let before = [ |
e84e45786691
commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 \ 'set enc=utf-8', |
e84e45786691
commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 \ 'set fencs=cp932,utf-8', |
e84e45786691
commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 \ ] |
e84e45786691
commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 let after = [ |
e84e45786691
commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 \ 'write ++enc=utf-8 Xtestout', |
e84e45786691
commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 \ 'quit!', |
e84e45786691
commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 \ ] |
e84e45786691
commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 if has('win32') |
e84e45786691
commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 let pipecmd = 'type Xtestin | ' |
e84e45786691
commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 else |
e84e45786691
commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 let pipecmd = 'cat Xtestin | ' |
e84e45786691
commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
21 endif |
e84e45786691
commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
22 if RunVimPiped(before, after, '-', pipecmd) |
e84e45786691
commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 let lines = readfile('Xtestout') |
e84e45786691
commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
24 call assert_equal(linesin, lines) |
e84e45786691
commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
25 else |
e84e45786691
commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
26 call assert_equal('', 'RunVimPiped failed.') |
e84e45786691
commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
27 endif |
e84e45786691
commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
28 call delete('Xtestout') |
e84e45786691
commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
29 call delete('Xtestin') |
e84e45786691
commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
30 endfunc |
e84e45786691
commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
31 |
e84e45786691
commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
32 func Test_read_fifo_utf8() |
e84e45786691
commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
33 if !has('unix') |
e84e45786691
commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
34 return |
e84e45786691
commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
35 endif |
e84e45786691
commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
36 " Using bash/zsh's process substitution. |
e84e45786691
commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
37 if executable('bash') |
e84e45786691
commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
38 set shell=bash |
e84e45786691
commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
39 elseif executable('zsh') |
e84e45786691
commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
40 set shell=zsh |
e84e45786691
commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
41 else |
e84e45786691
commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
42 return |
e84e45786691
commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
43 endif |
e84e45786691
commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
44 let linesin = ['テスト', '€ÀÈÌÒÙ'] |
e84e45786691
commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
45 call writefile(linesin, 'Xtestin') |
e84e45786691
commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
46 let before = [ |
e84e45786691
commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
47 \ 'set enc=utf-8', |
e84e45786691
commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
48 \ 'set fencs=cp932,utf-8', |
e84e45786691
commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
49 \ ] |
e84e45786691
commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
50 let after = [ |
e84e45786691
commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
51 \ 'write ++enc=utf-8 Xtestout', |
e84e45786691
commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
52 \ 'quit!', |
e84e45786691
commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
53 \ ] |
e84e45786691
commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
54 if RunVim(before, after, '<(cat Xtestin)') |
e84e45786691
commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
55 let lines = readfile('Xtestout') |
e84e45786691
commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
56 call assert_equal(linesin, lines) |
e84e45786691
commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
57 else |
e84e45786691
commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
58 call assert_equal('', 'RunVim failed.') |
e84e45786691
commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
59 endif |
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 call delete('Xtestin') |
e84e45786691
commit https://github.com/vim/vim/commit/f71d7b9ee5ceba75f70c30845332ddd728fd16c6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
62 endfunc |
14750
1e6666885bc0
patch 8.1.0387: no test for 'ambiwidth' detection
Christian Brabandt <cb@256bit.org>
parents:
9828
diff
changeset
|
63 |
1e6666885bc0
patch 8.1.0387: no test for 'ambiwidth' detection
Christian Brabandt <cb@256bit.org>
parents:
9828
diff
changeset
|
64 func Test_detect_ambiwidth() |
1e6666885bc0
patch 8.1.0387: no test for 'ambiwidth' detection
Christian Brabandt <cb@256bit.org>
parents:
9828
diff
changeset
|
65 if !CanRunVimInTerminal() |
16965
ba7727889385
patch 8.1.1483: skipped tests are not properly listed
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
66 throw 'Skipped: cannot run Vim in a terminal window' |
14750
1e6666885bc0
patch 8.1.0387: no test for 'ambiwidth' detection
Christian Brabandt <cb@256bit.org>
parents:
9828
diff
changeset
|
67 endif |
1e6666885bc0
patch 8.1.0387: no test for 'ambiwidth' detection
Christian Brabandt <cb@256bit.org>
parents:
9828
diff
changeset
|
68 |
1e6666885bc0
patch 8.1.0387: no test for 'ambiwidth' detection
Christian Brabandt <cb@256bit.org>
parents:
9828
diff
changeset
|
69 " 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
|
70 call writefile([ |
1e6666885bc0
patch 8.1.0387: no test for 'ambiwidth' detection
Christian Brabandt <cb@256bit.org>
parents:
9828
diff
changeset
|
71 \ 'set enc=utf-8', |
1e6666885bc0
patch 8.1.0387: no test for 'ambiwidth' detection
Christian Brabandt <cb@256bit.org>
parents:
9828
diff
changeset
|
72 \ 'set ambiwidth=double', |
1e6666885bc0
patch 8.1.0387: no test for 'ambiwidth' detection
Christian Brabandt <cb@256bit.org>
parents:
9828
diff
changeset
|
73 \ '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
|
74 \ 'redraw', |
1e6666885bc0
patch 8.1.0387: no test for 'ambiwidth' detection
Christian Brabandt <cb@256bit.org>
parents:
9828
diff
changeset
|
75 \ ], 'Xscript') |
1e6666885bc0
patch 8.1.0387: no test for 'ambiwidth' detection
Christian Brabandt <cb@256bit.org>
parents:
9828
diff
changeset
|
76 let buf = RunVimInTerminal('-S Xscript', {}) |
1e6666885bc0
patch 8.1.0387: no test for 'ambiwidth' detection
Christian Brabandt <cb@256bit.org>
parents:
9828
diff
changeset
|
77 call term_wait(buf) |
1e6666885bc0
patch 8.1.0387: no test for 'ambiwidth' detection
Christian Brabandt <cb@256bit.org>
parents:
9828
diff
changeset
|
78 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
|
79 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
|
80 |
1e6666885bc0
patch 8.1.0387: no test for 'ambiwidth' detection
Christian Brabandt <cb@256bit.org>
parents:
9828
diff
changeset
|
81 call StopVimInTerminal(buf) |
1e6666885bc0
patch 8.1.0387: no test for 'ambiwidth' detection
Christian Brabandt <cb@256bit.org>
parents:
9828
diff
changeset
|
82 call delete('Xscript') |
1e6666885bc0
patch 8.1.0387: no test for 'ambiwidth' detection
Christian Brabandt <cb@256bit.org>
parents:
9828
diff
changeset
|
83 endfunc |