comparison src/testdir/test_xxd.vim @ 27118:2f854597399f v8.2.4088

patch 8.2.4088: xxd cannot output everything in one line Commit: https://github.com/vim/vim/commit/c0a1d370fa655cea9eaa74f5e605b95825dc9de1 Author: Erik Auerswald <auerswal@unix-ag.uni-kl.de> Date: Fri Jan 14 11:58:48 2022 +0000 patch 8.2.4088: xxd cannot output everything in one line Problem: Xxd cannot output everything in one line. Solution: Make zero columns mean infinite columns. (Erik Auerswald, closes #9524)
author Bram Moolenaar <Bram@vim.org>
date Fri, 14 Jan 2022 13:00:07 +0100
parents 4061623aa316
children 948c947cb1ed
comparison
equal deleted inserted replaced
27117:a11e7c054f98 27118:2f854597399f
318 endfor 318 endfor
319 endfor 319 endfor
320 endfunc 320 endfunc
321 321
322 " -c0 selects the format specific default column value, as if no -c was given 322 " -c0 selects the format specific default column value, as if no -c was given
323 " except for -ps, where it disables extra newlines
323 func Test_xxd_c0_is_def_cols() 324 func Test_xxd_c0_is_def_cols()
324 call writefile(["abcdefghijklmnopqrstuvwxyz0123456789"], 'Xxdin') 325 call writefile(["abcdefghijklmnopqrstuvwxyz0123456789"], 'Xxdin')
325 for cols in ['-c0', '-c 0', '-cols 0'] 326 for cols in ['-c0', '-c 0', '-cols 0']
326 for fmt in ['', '-b', '-e', '-i', '-p', ] 327 for fmt in ['', '-b', '-e', '-i']
327 exe 'r! ' . s:xxd_cmd . ' ' . fmt ' Xxdin > Xxdout1' 328 exe 'r! ' . s:xxd_cmd . ' ' . fmt ' Xxdin > Xxdout1'
328 exe 'r! ' . s:xxd_cmd . ' ' . cols . ' ' . fmt ' Xxdin > Xxdout2' 329 exe 'r! ' . s:xxd_cmd . ' ' . cols . ' ' . fmt ' Xxdin > Xxdout2'
329 call assert_equalfile('Xxdout1', 'Xxdout2') 330 call assert_equalfile('Xxdout1', 'Xxdout2')
330 endfor 331 endfor
331 endfor 332 endfor
332 call delete('Xxdin') 333 call delete('Xxdin')
333 call delete('Xxdout1') 334 call delete('Xxdout1')
334 call delete('Xxdout2') 335 call delete('Xxdout2')
335 endfunc 336 endfunc
336 337
338 " all output in a single line for -c0 -ps
339 func Test_xxd_plain_one_line()
340 call writefile([
341 \ "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",
342 \ "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",
343 \ "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",
344 \ "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",
345 \ "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",
346 \ "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"],
347 \ 'Xxdin')
348 for cols in ['-c0', '-c 0', '-cols 0']
349 exe 'r! ' . s:xxd_cmd . ' -ps ' . cols ' Xxdin'
350 " output seems to start in line 2
351 let out = join(getline(2, '$'))
352 bwipe!
353 " newlines in xxd output result in spaces in the string variable out
354 call assert_notmatch(" ", out)
355 " xxd output must be non-empty and comprise only lower case hex digits
356 call assert_match("^[0-9a-f][0-9a-f]*$", out)
357 endfor
358 call delete('Xxdin')
359 endfunc
360
337 " vim: shiftwidth=2 sts=2 expandtab 361 " vim: shiftwidth=2 sts=2 expandtab