Mercurial > vim
comparison src/testdir/test_xxd.vim @ 15630:db6cfc44eb65 v8.1.0823
patch 8.1.0823: not sufficient testing of xxd
commit https://github.com/vim/vim/commit/203651b9b2e2f478c9a2be25f86ce9712a21a796
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Jan 26 14:11:19 2019 +0100
patch 8.1.0823: not sufficient testing of xxd
Problem: Not sufficient testing of xxd.
Solution: Add some more test coverage.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 26 Jan 2019 14:15:12 +0100 |
parents | 11879b89bb69 |
children | f7b88b1d3350 |
comparison
equal
deleted
inserted
replaced
15629:dd2e0b83a660 | 15630:db6cfc44eb65 |
---|---|
73 | 73 |
74 " Test 6: Print the date from xxd.1 | 74 " Test 6: Print the date from xxd.1 |
75 let s:test += 1 | 75 let s:test += 1 |
76 for arg in ['-l 13', '-l13', '-len 13'] | 76 for arg in ['-l 13', '-l13', '-len 13'] |
77 %d | 77 %d |
78 exe '0r! ' . s:xxd_cmd . ' -s 0x36 -l 13 -cols 13 ' . fname | 78 exe '0r! ' . s:xxd_cmd . ' -s 0x36 ' . arg . ' -cols 13 ' . fname |
79 $d | 79 $d |
80 call assert_equal('00000036: 3231 7374 204d 6179 2031 3939 36 21st May 1996', getline(1), s:Mess(s:test)) | 80 call assert_equal('00000036: 3231 7374 204d 6179 2031 3939 36 21st May 1996', getline(1), s:Mess(s:test)) |
81 endfor | 81 endfor |
82 | 82 |
83 " Test 7: Print C include | 83 " Test 7: Print C include |
129 let expected = ['00000000: 54455354 61626364 30390a TESTabcd09.'] | 129 let expected = ['00000000: 54455354 61626364 30390a TESTabcd09.'] |
130 call assert_equal(expected, getline(1,'$'), s:Mess(s:test)) | 130 call assert_equal(expected, getline(1,'$'), s:Mess(s:test)) |
131 call delete('XXDfile') | 131 call delete('XXDfile') |
132 endfor | 132 endfor |
133 | 133 |
134 " Test 11: reverse with CR, hex upper, Postscript style with a TAB | |
135 let s:test += 1 | |
136 call writefile([" 54455354\t610B6364 30390A TESTa\0x0bcd09.\r"], 'Xinput') | |
137 silent exe '!' . s:xxd_cmd . ' -r -p < Xinput > XXDfile' | |
138 let blob = readfile('XXDfile', 'B') | |
139 call assert_equal(0z54455354.610B6364.30390A, blob) | |
140 call delete('Xinput') | |
141 call delete('XXDfile') | |
142 | |
143 " Test 12: reverse with seek | |
144 let s:test += 1 | |
145 call writefile(["00000000: 54455354\t610B6364 30390A TESTa\0x0bcd09.\r"], 'Xinput') | |
146 silent exe '!' . s:xxd_cmd . ' -r -seek 5 < Xinput > XXDfile' | |
147 let blob = readfile('XXDfile', 'B') | |
148 call assert_equal(0z0000000000.54455354.610B6364.30390A, blob) | |
149 call delete('Xinput') | |
150 call delete('XXDfile') | |
151 | |
134 " TODO: | 152 " TODO: |
135 " -o -offset | 153 " -o -offset |
136 | 154 |
137 %d | 155 %d |
138 bw! | 156 bw! |