Mercurial > vim
comparison src/testdir/test_digraph.vim @ 9616:6144d9bfb037 v7.4.2085
commit https://github.com/vim/vim/commit/dfd63e30d13fff5603416b6c7e247cebeb003eb0
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Jul 21 10:11:03 2016 +0200
patch 7.4.2085
Problem: Digraph tests fails on some systems.
Solution: Run it separately and set 'encoding' early.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Thu, 21 Jul 2016 10:15:05 +0200 |
parents | d9d3ef70c859 |
children | 81ba6e4eb72b |
comparison
equal
deleted
inserted
replaced
9615:b00b3aa68217 | 9616:6144d9bfb037 |
---|---|
2 | 2 |
3 if !has("digraphs") || !has("multi_byte") | 3 if !has("digraphs") || !has("multi_byte") |
4 finish | 4 finish |
5 endif | 5 endif |
6 | 6 |
7 set enc=utf-8 | |
7 scriptencoding utf-8 | 8 scriptencoding utf-8 |
8 | 9 |
9 func! Put_Dig(chars) | 10 func! Put_Dig(chars) |
10 exe "norm! o\<c-k>".a:chars | 11 exe "norm! o\<c-k>".a:chars |
11 endfu | 12 endfu |
13 func! Put_Dig_BS(char1, char2) | 14 func! Put_Dig_BS(char1, char2) |
14 exe "norm! o".a:char1."\<bs>".a:char2 | 15 exe "norm! o".a:char1."\<bs>".a:char2 |
15 endfu | 16 endfu |
16 | 17 |
17 func! Test_digraphs() | 18 func! Test_digraphs() |
18 let _enc = &enc | |
19 set enc=utf8 | |
20 new | 19 new |
21 call Put_Dig("00") | 20 call Put_Dig("00") |
22 call assert_equal("∞", getline('.')) | 21 call assert_equal("∞", getline('.')) |
23 " not a digraph | 22 " not a digraph |
24 call Put_Dig("el") | 23 call Put_Dig("el") |
213 digraph 00 8734 | 212 digraph 00 8734 |
214 digraph el 108 | 213 digraph el 108 |
215 call Put_Dig("00") | 214 call Put_Dig("00") |
216 call Put_Dig("el") | 215 call Put_Dig("el") |
217 call assert_equal(['␀', 'ü', '∞', 'l'], getline(line('.')-3,line('.'))) | 216 call assert_equal(['␀', 'ü', '∞', 'l'], getline(line('.')-3,line('.'))) |
218 " reset encoding option | |
219 let &enc = _enc | |
220 bw! | 217 bw! |
221 endfunc | 218 endfunc |
222 | 219 |
223 func! Test_digraphs_option() | 220 func! Test_digraphs_option() |
224 let _enc=&enc | |
225 " reset whichwrap option, so that testing <esc><bs>A works, | 221 " reset whichwrap option, so that testing <esc><bs>A works, |
226 " without moving up a line | 222 " without moving up a line |
227 set enc=utf8 digraph ww= | 223 set digraph ww= |
228 new | 224 new |
229 call Put_Dig_BS("0","0") | 225 call Put_Dig_BS("0","0") |
230 call assert_equal("∞", getline('.')) | 226 call assert_equal("∞", getline('.')) |
231 " not a digraph | 227 " not a digraph |
232 call Put_Dig_BS("e","l") | 228 call Put_Dig_BS("e","l") |
421 digraph 00 8734 | 417 digraph 00 8734 |
422 digraph el 108 | 418 digraph el 108 |
423 call Put_Dig_BS("0","0") | 419 call Put_Dig_BS("0","0") |
424 call Put_Dig_BS("e","l") | 420 call Put_Dig_BS("e","l") |
425 call assert_equal(['␀', 'ü', '∞', 'l'], getline(line('.')-3,line('.'))) | 421 call assert_equal(['␀', 'ü', '∞', 'l'], getline(line('.')-3,line('.'))) |
426 " reset encoding option | |
427 let &enc = _enc | |
428 set nodigraph ww&vim | 422 set nodigraph ww&vim |
429 bw! | 423 bw! |
430 endfunc | 424 endfunc |
431 | 425 |
432 " vim: tabstop=2 shiftwidth=0 sts=-1 expandtab | 426 " vim: tabstop=2 shiftwidth=0 sts=-1 expandtab |