summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.0025
blob: 90c8657c172b0c797aa64aaadd0f65d7f8c73baa (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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0025
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.0025
Problem:    No test for the undofile() function.
Solution:   Add test. (Dominique Pelle, closes #2958)
Files:	    src/testdir/test_undo.vim


*** ../vim-8.1.0024/src/testdir/test_undo.vim	2018-02-06 22:06:44.000000000 +0100
--- src/testdir/test_undo.vim	2018-05-26 18:45:22.924163341 +0200
***************
*** 85,91 ****
  func FillBuffer()
    for i in range(1,13)
      put=i
!     " Set 'undolevels' to split undo. 
      exe "setg ul=" . &g:ul
    endfor
  endfunc
--- 85,91 ----
  func FillBuffer()
    for i in range(1,13)
      put=i
!     " Set 'undolevels' to split undo.
      exe "setg ul=" . &g:ul
    endfor
  endfunc
***************
*** 193,211 ****
    new
    set ul=100
  
!   let a=execute('undolist')
    call assert_equal("\nNothing to undo", a)
  
    " 1 leaf (2 changes).
    call feedkeys('achange1', 'xt')
    call feedkeys('achange2', 'xt')
!   let a=execute('undolist')
    call assert_match("^\nnumber changes  when  *saved\n *2  *2 .*$", a)
  
    " 2 leaves.
    call feedkeys('u', 'xt')
    call feedkeys('achange3\<Esc>', 'xt')
!   let a=execute('undolist')
    call assert_match("^\nnumber changes  when  *saved\n *2  *2  *.*\n *3  *2 .*$", a)
    close!
  endfunc
--- 193,211 ----
    new
    set ul=100
  
!   let a = execute('undolist')
    call assert_equal("\nNothing to undo", a)
  
    " 1 leaf (2 changes).
    call feedkeys('achange1', 'xt')
    call feedkeys('achange2', 'xt')
!   let a = execute('undolist')
    call assert_match("^\nnumber changes  when  *saved\n *2  *2 .*$", a)
  
    " 2 leaves.
    call feedkeys('u', 'xt')
    call feedkeys('achange3\<Esc>', 'xt')
!   let a = execute('undolist')
    call assert_match("^\nnumber changes  when  *saved\n *2  *2  *.*\n *3  *2 .*$", a)
    close!
  endfunc
***************
*** 339,345 ****
  " Also test this in an empty buffer.
  func Test_cmd_in_reg_undo()
    enew!
!   let @a="Ox\<Esc>jAy\<Esc>kdd"
    edit +/^$ test_undo.vim
    normal @au
    call assert_equal(0, &modified)
--- 339,345 ----
  " Also test this in an empty buffer.
  func Test_cmd_in_reg_undo()
    enew!
!   let @a = "Ox\<Esc>jAy\<Esc>kdd"
    edit +/^$ test_undo.vim
    normal @au
    call assert_equal(0, &modified)
***************
*** 348,354 ****
    normal @au
    call assert_equal(0, &modified)
    only!
!   let @a=''
  endfunc
  
  " This used to cause an illegal memory access
--- 348,354 ----
    normal @au
    call assert_equal(0, &modified)
    only!
!   let @a = ''
  endfunc
  
  " This used to cause an illegal memory access
***************
*** 410,412 ****
--- 410,444 ----
    exe "norm."
    bwipe!
  endfunc
+ 
+ funct Test_undofile()
+   " Test undofile() without setting 'undodir'.
+   if has('persistent_undo')
+     call assert_equal(fnamemodify('.Xundofoo.un~', ':p'), undofile('Xundofoo'))
+   else
+     call assert_equal('', undofile('Xundofoo'))
+   endif
+   call assert_equal('', undofile(''))
+ 
+   " Test undofile() with 'undodir' set to to an existing directory.
+   call mkdir('Xundodir')
+   set undodir=Xundodir
+   let cwd = getcwd()
+   if has('win32')
+     " Replace windows drive such as C:... into C%...
+     let cwd = substitute(cwd, '^\([A-Z]\):', '\1%', 'g')
+   endif
+   let cwd = substitute(cwd . '/Xundofoo', '/', '%', 'g')
+   if has('persistent_undo')
+     call assert_equal('Xundodir/' . cwd, undofile('Xundofoo'))
+   else
+     call assert_equal('', undofile('Xundofoo'))
+   endif
+   call assert_equal('', undofile(''))
+   call delete('Xundodir', 'd')
+ 
+   " Test undofile() with 'undodir' set to a non-existing directory.
+   call assert_equal('', undofile('Xundofoo'))
+ 
+   set undodir&
+ endfunc
*** ../vim-8.1.0024/src/version.c	2018-05-26 18:39:29.608575858 +0200
--- src/version.c	2018-05-26 18:43:40.832284081 +0200
***************
*** 763,764 ****
--- 763,766 ----
  {   /* Add new patch number below this line */
+ /**/
+     25,
  /**/

-- 
Engineers are always delighted to share wisdom, even in areas in which they
have no experience whatsoever.  Their logic provides them with inherent
insight into any field of expertise.  This can be a problem when dealing with
the illogical people who believe that knowledge can only be derived through
experience.
				(Scott Adams - The Dilbert principle)

 /// 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    ///