summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.0008
blob: 98c193276e43a8b592d5c8a1b4a31822ac976b43 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0008
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 8.1.0008
Problem:    No test for strwidth().
Solution:   Add a test. (Dominique Pelle, closes #2931)
Files:	    src/testdir/test_functions.vim


*** ../vim-8.1.0007/src/testdir/test_functions.vim	2018-03-22 22:48:20.000000000 +0100
--- src/testdir/test_functions.vim	2018-05-20 14:09:31.346367348 +0200
***************
*** 96,101 ****
--- 96,125 ----
    call assert_fails('call min(v:none)', 'E712:')
  endfunc
  
+ func Test_strwidth()
+   for aw in ['single', 'double']
+     exe 'set ambiwidth=' . aw
+     call assert_equal(0, strwidth(''))
+     call assert_equal(1, strwidth("\t"))
+     call assert_equal(3, strwidth('Vim'))
+     call assert_equal(4, strwidth(1234))
+     call assert_equal(5, strwidth(-1234))
+ 
+     if has('multi_byte')
+       call assert_equal(2, strwidth('😉'))
+       call assert_equal(17, strwidth('Eĥoŝanĝo ĉiuĵaŭde'))
+       call assert_equal((aw == 'single') ? 6 : 7, strwidth('Straße'))
+     endif
+ 
+     call assert_fails('call strwidth({->0})', 'E729:')
+     call assert_fails('call strwidth([])', 'E730:')
+     call assert_fails('call strwidth({})', 'E731:')
+     call assert_fails('call strwidth(1.2)', 'E806:')
+   endfor
+ 
+   set ambiwidth&
+ endfunc
+ 
  func Test_str2nr()
    call assert_equal(0, str2nr(''))
    call assert_equal(1, str2nr('1'))
*** ../vim-8.1.0007/src/version.c	2018-05-20 14:06:34.506186527 +0200
--- src/version.c	2018-05-20 14:10:31.208184912 +0200
***************
*** 763,764 ****
--- 763,766 ----
  {   /* Add new patch number below this line */
+ /**/
+     8,
  /**/

-- 
ARTHUR: The swallow may fly south with the sun, or the house martin or the
        plover seek warmer hot lands in winter, yet these are not strangers to
        our land.
SOLDIER: Are you suggesting coconuts migrate?
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///