Mercurial > vim
diff 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 |
line wrap: on
line diff
--- a/src/testdir/test_xxd.vim +++ b/src/testdir/test_xxd.vim @@ -213,6 +213,39 @@ func Test_xxd() call delete('XXDfile') endfunc +func Test_xxd_patch() + let cmd = 'silent !' .. s:xxd_cmd .. ' -r Xxxdin Xxxdfile; ' .. s:xxd_cmd .. ' -g1 Xxxdfile > Xxxdout' + call writefile(["2: 41 41", "8: 42 42"], 'Xxxdin') + call writefile(['::::::::'], 'Xxxdfile') + exe cmd + call assert_equal(['00000000: 3a 3a 41 41 3a 3a 3a 3a 42 42 ::AA::::BB'], readfile('Xxxdout')) + + call writefile(["2: 43 43 ", "8: 44 44"], 'Xxxdin') + exe cmd + call assert_equal(['00000000: 3a 3a 43 43 3a 3a 3a 3a 44 44 ::CC::::DD'], readfile('Xxxdout')) + + call writefile(["2: 45 45 ", "8: 46 46"], 'Xxxdin') + exe cmd + call assert_equal(['00000000: 3a 3a 45 45 3a 3a 3a 3a 46 46 ::EE::::FF'], readfile('Xxxdout')) + + call writefile(["2: 41 41", "08: 42 42"], 'Xxxdin') + call writefile(['::::::::'], 'Xxxdfile') + exe cmd + call assert_equal(['00000000: 3a 3a 41 41 3a 3a 3a 3a 42 42 ::AA::::BB'], readfile('Xxxdout')) + + call writefile(["2: 43 43 ", "09: 44 44"], 'Xxxdin') + exe cmd + call assert_equal(['00000000: 3a 3a 43 43 3a 3a 3a 3a 42 44 44 ::CC::::BDD'], readfile('Xxxdout')) + + call writefile(["2: 45 45 ", "0a: 46 46"], 'Xxxdin') + exe cmd + call assert_equal(['00000000: 3a 3a 45 45 3a 3a 3a 3a 42 44 46 46 ::EE::::BDFF'], readfile('Xxxdout')) + + call delete('Xxxdin') + call delete('Xxxdfile') + call delete('Xxxdout') +endfunc + " Various ways with wrong arguments that trigger the usage output. func Test_xxd_usage() for arg in ['-c', '-g', '-o', '-s', '-l', '-X', 'one two three']