comparison src/testdir/test_crypt.vim @ 25362:68a7e6d70a5e v8.2.3218

patch 8.2.3218: when using xchaha20 crypt undo file is not removed Commit: https://github.com/vim/vim/commit/8a4c812ede5b01a8e71082c1ff4ebfcbf1bd515f Author: Christian Brabandt <cb@256bit.org> Date: Sun Jul 25 14:36:05 2021 +0200 patch 8.2.3218: when using xchaha20 crypt undo file is not removed Problem: When using xchaha20 crypt undo file is not removed. Solution: Reset 'undofile' and delete the file. (Christian Brabandt, closes #8630, closes #8467)
author Bram Moolenaar <Bram@vim.org>
date Sun, 25 Jul 2021 14:45:04 +0200
parents 1ef6880ba4a9
children 8b34c216a523
comparison
equal deleted inserted replaced
25361:7784e9d84ff6 25362:68a7e6d70a5e
131 call feedkeys(":split samples/crypt_sodium_invalid.txt\<CR>sodium\<CR>", 'xt') 131 call feedkeys(":split samples/crypt_sodium_invalid.txt\<CR>sodium\<CR>", 'xt')
132 call assert_false(1, 'should not happen') 132 call assert_false(1, 'should not happen')
133 catch 133 catch
134 call assert_exception('pre-mature') 134 call assert_exception('pre-mature')
135 endtry 135 endtry
136 call assert_match("Note: Encryption of swapfile not supported, disabling swap- and undofile", execute(':5messages')) 136 call assert_match("Note: Encryption of swapfile not supported, disabling swap file", execute(':5messages'))
137 137
138 call assert_equal(0, &swapfile) 138 call assert_equal(0, &swapfile)
139 call assert_equal("xchacha20", &cryptmethod) 139 call assert_equal("xchacha20", &cryptmethod)
140 call assert_equal('311111111111111111111111', getline('$')) 140 call assert_equal('311111111111111111111111', getline('$'))
141 bw! 141 bw!
150 call assert_equal(1, &swapfile) 150 call assert_equal(1, &swapfile)
151 set cryptmethod=xchacha20 151 set cryptmethod=xchacha20
152 call feedkeys(":X\<CR>sodium\<CR>sodium\<CR>", 'xt') 152 call feedkeys(":X\<CR>sodium\<CR>sodium\<CR>", 'xt')
153 " swapfile disabled 153 " swapfile disabled
154 call assert_equal(0, &swapfile) 154 call assert_equal(0, &swapfile)
155 call assert_match("Note: Encryption of swapfile not supported, disabling swap- and undofile", execute(':messages')) 155 call assert_match("Note: Encryption of swapfile not supported, disabling swap file", execute(':messages'))
156 w! 156 w!
157 " encrypted using xchacha20 157 " encrypted using xchacha20
158 call assert_match("\[xchacha20\]", execute(':messages')) 158 call assert_match("\[xchacha20\]", execute(':messages'))
159 bw! 159 bw!
160 call feedkeys(":sp Xcrypt_sodium.txt\<CR>sodium\<CR>", 'xt') 160 call feedkeys(":sp Xcrypt_sodium.txt\<CR>sodium\<CR>", 'xt')
174 CheckFeature persistent_undo 174 CheckFeature persistent_undo
175 175
176 sp Xcrypt_sodium_undo.txt 176 sp Xcrypt_sodium_undo.txt
177 set cryptmethod=xchacha20 undofile 177 set cryptmethod=xchacha20 undofile
178 call feedkeys(":X\<CR>sodium\<CR>sodium\<CR>", 'xt') 178 call feedkeys(":X\<CR>sodium\<CR>sodium\<CR>", 'xt')
179 call assert_equal(0, &undofile) 179 call assert_equal(1, &undofile)
180 let ufile=undofile(@%) 180 let ufile=undofile(@%)
181 call append(0, ['monday', 'tuesday', 'wednesday', 'thursday', 'friday']) 181 call append(0, ['monday', 'tuesday', 'wednesday', 'thursday', 'friday'])
182 call cursor(1, 1) 182 call cursor(1, 1)
183 183
184 set undolevels=100 184 set undolevels=100
187 normal dd 187 normal dd
188 set undolevels=100 188 set undolevels=100
189 normal dd 189 normal dd
190 set undolevels=100 190 set undolevels=100
191 w! 191 w!
192 call assert_equal(0, &undofile)
192 bw! 193 bw!
193 call feedkeys(":sp Xcrypt_sodium_undo.txt\<CR>sodium\<CR>", 'xt') 194 call feedkeys(":sp Xcrypt_sodium_undo.txt\<CR>sodium\<CR>", 'xt')
194 " should fail 195 " should fail
195 norm! u 196 norm! u
196 call assert_match('Already at oldest change', execute(':1mess')) 197 call assert_match('Already at oldest change', execute(':1mess'))