Mercurial > vim
comparison src/testdir/test_xxd.vim @ 26036:c8165ec9dcad v8.2.3552
patch 8.2.3552: xxd revert does not handle end of line correctly
Commit: https://github.com/vim/vim/commit/47810464aa4f9edbf222c02a860a3ec560b0b7a1
Author: DungSaga <dungsaga@users.noreply.github.com>
Date: Fri Oct 22 12:55:42 2021 +0100
patch 8.2.3552: xxd revert does not handle end of line correctly
Problem: Xxd revert does not handle end of line correctly.
Solution: Check for newline first. (closes https://github.com/vim/vim/issues/9034)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 22 Oct 2021 14:00:07 +0200 |
parents | 5690cf66ee07 |
children | 542cc55a660b |
comparison
equal
deleted
inserted
replaced
26035:5bcf2c40d6c8 | 26036:c8165ec9dcad |
---|---|
211 %d | 211 %d |
212 bwipe! | 212 bwipe! |
213 call delete('XXDfile') | 213 call delete('XXDfile') |
214 endfunc | 214 endfunc |
215 | 215 |
216 func Test_xxd_patch() | |
217 let cmd = 'silent !' .. s:xxd_cmd .. ' -r Xxxdin Xxxdfile; ' .. s:xxd_cmd .. ' -g1 Xxxdfile > Xxxdout' | |
218 call writefile(["2: 41 41", "8: 42 42"], 'Xxxdin') | |
219 call writefile(['::::::::'], 'Xxxdfile') | |
220 exe cmd | |
221 call assert_equal(['00000000: 3a 3a 41 41 3a 3a 3a 3a 42 42 ::AA::::BB'], readfile('Xxxdout')) | |
222 | |
223 call writefile(["2: 43 43 ", "8: 44 44"], 'Xxxdin') | |
224 exe cmd | |
225 call assert_equal(['00000000: 3a 3a 43 43 3a 3a 3a 3a 44 44 ::CC::::DD'], readfile('Xxxdout')) | |
226 | |
227 call writefile(["2: 45 45 ", "8: 46 46"], 'Xxxdin') | |
228 exe cmd | |
229 call assert_equal(['00000000: 3a 3a 45 45 3a 3a 3a 3a 46 46 ::EE::::FF'], readfile('Xxxdout')) | |
230 | |
231 call writefile(["2: 41 41", "08: 42 42"], 'Xxxdin') | |
232 call writefile(['::::::::'], 'Xxxdfile') | |
233 exe cmd | |
234 call assert_equal(['00000000: 3a 3a 41 41 3a 3a 3a 3a 42 42 ::AA::::BB'], readfile('Xxxdout')) | |
235 | |
236 call writefile(["2: 43 43 ", "09: 44 44"], 'Xxxdin') | |
237 exe cmd | |
238 call assert_equal(['00000000: 3a 3a 43 43 3a 3a 3a 3a 42 44 44 ::CC::::BDD'], readfile('Xxxdout')) | |
239 | |
240 call writefile(["2: 45 45 ", "0a: 46 46"], 'Xxxdin') | |
241 exe cmd | |
242 call assert_equal(['00000000: 3a 3a 45 45 3a 3a 3a 3a 42 44 46 46 ::EE::::BDFF'], readfile('Xxxdout')) | |
243 | |
244 call delete('Xxxdin') | |
245 call delete('Xxxdfile') | |
246 call delete('Xxxdout') | |
247 endfunc | |
248 | |
216 " Various ways with wrong arguments that trigger the usage output. | 249 " Various ways with wrong arguments that trigger the usage output. |
217 func Test_xxd_usage() | 250 func Test_xxd_usage() |
218 for arg in ['-c', '-g', '-o', '-s', '-l', '-X', 'one two three'] | 251 for arg in ['-c', '-g', '-o', '-s', '-l', '-X', 'one two three'] |
219 new | 252 new |
220 exe 'r! ' . s:xxd_cmd . ' ' . arg | 253 exe 'r! ' . s:xxd_cmd . ' ' . arg |