To: vim_dev@googlegroups.com Subject: Patch 8.0.1695 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.1695 Problem: Xxd test not run on MS-Windows. Solution: Use xxd.exe if it exists. Files: src/testdir/test_xxd.vim *** ../vim-8.0.1694/src/testdir/test_xxd.vim 2018-04-10 20:06:13.207096004 +0200 --- src/testdir/test_xxd.vim 2018-04-10 21:40:25.853308096 +0200 *************** *** 1,6 **** " Test for the xxd command ! if empty($XXD) || !executable($XXD) finish endif func! PrepareBuffer(lines) --- 1,10 ---- " Test for the xxd command ! if empty($XXD) && executable('..\xxd\xxd.exe') ! let s:xxd_cmd = '..\xxd\xxd.exe' ! elseif empty($XXD) || !executable($XXD) finish + else + let s:xxd_cmd = $XXD endif func! PrepareBuffer(lines) *************** *** 15,25 **** func! Test_xxd() call PrepareBuffer(range(1,30)) w XXDfile " Test 1: simple, filter the result through xxd let s:test = 1 ! %!$XXD % let expected = [ \ '00000000: 310a 320a 330a 340a 350a 360a 370a 380a 1.2.3.4.5.6.7.8.', \ '00000010: 390a 3130 0a31 310a 3132 0a31 330a 3134 9.10.11.12.13.14', --- 19,30 ---- func! Test_xxd() call PrepareBuffer(range(1,30)) + set ff=unix w XXDfile " Test 1: simple, filter the result through xxd let s:test = 1 ! exe '%!' . s:xxd_cmd . ' %' let expected = [ \ '00000000: 310a 320a 330a 340a 350a 360a 370a 380a 1.2.3.4.5.6.7.8.', \ '00000010: 390a 3130 0a31 310a 3132 0a31 330a 3134 9.10.11.12.13.14', *************** *** 31,53 **** " Test 2: reverse the result let s:test += 1 ! %!$XXD -r call assert_equal(map(range(1,30), {v,c -> string(c)}), getline(1,'$'), s:Mess(s:test)) " Test 3: Skip the first 30 bytes let s:test += 1 ! %!$XXD -s 0x30 % call assert_equal(expected[3:], getline(1,'$'), s:Mess(s:test)) " Test 4: Skip the first 30 bytes let s:test += 1 ! %!$XXD -s -0x31 % call assert_equal(expected[2:], getline(1,'$'), s:Mess(s:test)) " Test 5: Print 120 bytes as continuous hexdump with 20 octets per line let s:test += 1 %d ! 0r! $XXD -l 120 -ps -c 20 ../../runtime/doc/xxd.1 $d let expected = [ \ '2e54482058584420312022417567757374203139', --- 36,58 ---- " Test 2: reverse the result let s:test += 1 ! exe '%!' . s:xxd_cmd . ' -r' call assert_equal(map(range(1,30), {v,c -> string(c)}), getline(1,'$'), s:Mess(s:test)) " Test 3: Skip the first 30 bytes let s:test += 1 ! exe '%!' . s:xxd_cmd . ' -s 0x30 %' call assert_equal(expected[3:], getline(1,'$'), s:Mess(s:test)) " Test 4: Skip the first 30 bytes let s:test += 1 ! exe '%!' . s:xxd_cmd . ' -s -0x31 %' call assert_equal(expected[2:], getline(1,'$'), s:Mess(s:test)) " Test 5: Print 120 bytes as continuous hexdump with 20 octets per line let s:test += 1 %d ! exe '0r! ' . s:xxd_cmd . ' -l 120 -ps -c 20 ../../runtime/doc/xxd.1' $d let expected = [ \ '2e54482058584420312022417567757374203139', *************** *** 61,67 **** " Test 6: Print the date from xxd.1 let s:test += 1 %d ! 0r! $XXD -s 0x36 -l 13 -c 13 ../../runtime/doc/xxd.1 $d call assert_equal('00000036: 3231 7374 204d 6179 2031 3939 36 21st May 1996', getline(1), s:Mess(s:test)) --- 66,72 ---- " Test 6: Print the date from xxd.1 let s:test += 1 %d ! exe '0r! ' . s:xxd_cmd . ' -s 0x36 -l 13 -c 13 ../../runtime/doc/xxd.1' $d call assert_equal('00000036: 3231 7374 204d 6179 2031 3939 36 21st May 1996', getline(1), s:Mess(s:test)) *************** *** 69,75 **** let s:test += 1 call writefile(['TESTabcd09'], 'XXDfile') %d ! 0r! $XXD -i XXDfile $d let expected = ['unsigned char XXDfile[] = {', \ ' 0x54, 0x45, 0x53, 0x54, 0x61, 0x62, 0x63, 0x64, 0x30, 0x39, 0x0a', '};', --- 74,80 ---- let s:test += 1 call writefile(['TESTabcd09'], 'XXDfile') %d ! exe '0r! ' . s:xxd_cmd . ' -i XXDfile' $d let expected = ['unsigned char XXDfile[] = {', \ ' 0x54, 0x45, 0x53, 0x54, 0x61, 0x62, 0x63, 0x64, 0x30, 0x39, 0x0a', '};', *************** *** 80,86 **** let s:test += 1 call writefile(['TESTabcd09'], 'XXDfile') %d ! 0r! $XXD -i -C XXDfile $d let expected = ['unsigned char XXDFILE[] = {', \ ' 0x54, 0x45, 0x53, 0x54, 0x61, 0x62, 0x63, 0x64, 0x30, 0x39, 0x0a', '};', --- 85,91 ---- let s:test += 1 call writefile(['TESTabcd09'], 'XXDfile') %d ! exe '0r! ' . s:xxd_cmd . ' -i -C XXDfile' $d let expected = ['unsigned char XXDFILE[] = {', \ ' 0x54, 0x45, 0x53, 0x54, 0x61, 0x62, 0x63, 0x64, 0x30, 0x39, 0x0a', '};', *************** *** 91,97 **** let s:test += 1 call delete('XXDfile') bwipe! XXDfile ! call system('echo "010000: 41"|'.$XXD.' -r -s -0x10000 > XXDfile') call PrepareBuffer(readfile('XXDfile')[0]) call assert_equal('A', getline(1), s:Mess(s:test)) call delete('XXDfile') --- 96,108 ---- let s:test += 1 call delete('XXDfile') bwipe! XXDfile ! if has('unix') ! call system('echo "010000: 41"|' . s:xxd_cmd . ' -r -s -0x10000 > XXDfile') ! else ! call writefile(['010000: 41'], 'Xinput') ! silent exe '!' . s:xxd_cmd . ' -r -s -0x10000 < Xinput > XXDfile' ! call delete('Xinput') ! endif call PrepareBuffer(readfile('XXDfile')[0]) call assert_equal('A', getline(1), s:Mess(s:test)) call delete('XXDfile') *** ../vim-8.0.1694/src/version.c 2018-04-10 21:43:22.422651857 +0200 --- src/version.c 2018-04-10 21:45:03.065927936 +0200 *************** *** 764,765 **** --- 764,767 ---- { /* Add new patch number below this line */ + /**/ + 1695, /**/ -- hundred-and-one symptoms of being an internet addict: 157. You fum through a magazine, you first check to see if it has a web address. /// 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 ///