Mercurial > vim
comparison src/testdir/test_xxd.vim @ 15647:f7b88b1d3350 v8.1.0831
patch 8.1.0831: xxd test fails if man page has dos fileformat
commit https://github.com/vim/vim/commit/0eb220c03057096a26dda9c5544b362dce6df4d7
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jan 27 14:41:43 2019 +0100
patch 8.1.0831: xxd test fails if man page has dos fileformat
Problem: Xxd test fails if man page has dos fileformat.
Solution: Make a copy with unix fileformat.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 27 Jan 2019 14:45:05 +0100 |
parents | db6cfc44eb65 |
children | 9c90cf08cfa8 |
comparison
equal
deleted
inserted
replaced
15646:841b2d2f5c3c | 15647:f7b88b1d3350 |
---|---|
51 for arg in ['-s -0x31', '-s-0x31'] | 51 for arg in ['-s -0x31', '-s-0x31'] |
52 exe '%!' . s:xxd_cmd . ' ' . arg . ' %' | 52 exe '%!' . s:xxd_cmd . ' ' . arg . ' %' |
53 call assert_equal(expected[2:], getline(1,'$'), s:Mess(s:test)) | 53 call assert_equal(expected[2:], getline(1,'$'), s:Mess(s:test)) |
54 endfor | 54 endfor |
55 | 55 |
56 " The following tests use the xxd man page. | |
57 " For these tests to pass, the fileformat must be "unix". | |
58 let man_copy = 'Xxd.1' | |
59 let man_page = '../../runtime/doc/xxd.1' | |
60 if has('win32') && !filereadable(man_page) | |
61 let man_page = '../../doc/xxd.1' | |
62 endif | |
63 %d | |
64 exe '0r ' man_page '| set ff=unix | $d | w' man_copy '| bwipe!' man_copy | |
65 | |
56 " Test 5: Print 120 bytes as continuous hexdump with 20 octets per line | 66 " Test 5: Print 120 bytes as continuous hexdump with 20 octets per line |
57 let s:test += 1 | 67 let s:test += 1 |
58 %d | 68 %d |
59 let fname = '../../runtime/doc/xxd.1' | 69 exe '0r! ' . s:xxd_cmd . ' -l 120 -ps -c20 ' . man_copy |
60 if has('win32') && !filereadable(fname) | |
61 let fname = '../../doc/xxd.1' | |
62 endif | |
63 exe '0r! ' . s:xxd_cmd . ' -l 120 -ps -c20 ' . fname | |
64 $d | 70 $d |
65 let expected = [ | 71 let expected = [ |
66 \ '2e54482058584420312022417567757374203139', | 72 \ '2e54482058584420312022417567757374203139', |
67 \ '39362220224d616e75616c207061676520666f72', | 73 \ '39362220224d616e75616c207061676520666f72', |
68 \ '20787864220a2e5c220a2e5c222032317374204d', | 74 \ '20787864220a2e5c220a2e5c222032317374204d', |
73 | 79 |
74 " Test 6: Print the date from xxd.1 | 80 " Test 6: Print the date from xxd.1 |
75 let s:test += 1 | 81 let s:test += 1 |
76 for arg in ['-l 13', '-l13', '-len 13'] | 82 for arg in ['-l 13', '-l13', '-len 13'] |
77 %d | 83 %d |
78 exe '0r! ' . s:xxd_cmd . ' -s 0x36 ' . arg . ' -cols 13 ' . fname | 84 exe '0r! ' . s:xxd_cmd . ' -s 0x36 ' . arg . ' -cols 13 ' . man_copy |
79 $d | 85 $d |
80 call assert_equal('00000036: 3231 7374 204d 6179 2031 3939 36 21st May 1996', getline(1), s:Mess(s:test)) | 86 call assert_equal('00000036: 3231 7374 204d 6179 2031 3939 36 21st May 1996', getline(1), s:Mess(s:test)) |
81 endfor | 87 endfor |
88 | |
89 " Cleanup after tests 5 and 6 | |
90 call delete(man_copy) | |
82 | 91 |
83 " Test 7: Print C include | 92 " Test 7: Print C include |
84 let s:test += 1 | 93 let s:test += 1 |
85 call writefile(['TESTabcd09'], 'XXDfile') | 94 call writefile(['TESTabcd09'], 'XXDfile') |
86 %d | 95 %d |