Mercurial > vim
comparison src/testdir/test_xxd.vim @ 20601:75ef263d09d6 v8.2.0854
patch 8.2.0854: xxd cannot show offset as a decimal number
Commit: https://github.com/vim/vim/commit/363d6148dfc2cc17fb0d286c7a36c305f56f5813
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat May 30 20:50:25 2020 +0200
patch 8.2.0854: xxd cannot show offset as a decimal number
Problem: Xxd cannot show offset as a decimal number.
Solution: Add the "-d" flag. (Aapo Rantalainen, closes https://github.com/vim/vim/issues/5616
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 30 May 2020 21:00:12 +0200 |
parents | 6990c1160ea5 |
children | d7d6993fc266 |
comparison
equal
deleted
inserted
replaced
20600:e592e571e52a | 20601:75ef263d09d6 |
---|---|
163 let blob = readfile('XXDfile', 'B') | 163 let blob = readfile('XXDfile', 'B') |
164 call assert_equal(0z0000000000.54455354.610B6364.30390A, blob) | 164 call assert_equal(0z0000000000.54455354.610B6364.30390A, blob) |
165 call delete('Xinput') | 165 call delete('Xinput') |
166 call delete('XXDfile') | 166 call delete('XXDfile') |
167 | 167 |
168 " Test 13: simple, decimal offset | |
169 call PrepareBuffer(range(1,30)) | |
170 set ff=unix | |
171 w! XXDfile | |
172 let s:test += 1 | |
173 exe '%!' . s:xxd_cmd . ' -d %' | |
174 let expected = [ | |
175 \ '00000000: 310a 320a 330a 340a 350a 360a 370a 380a 1.2.3.4.5.6.7.8.', | |
176 \ '00000016: 390a 3130 0a31 310a 3132 0a31 330a 3134 9.10.11.12.13.14', | |
177 \ '00000032: 0a31 350a 3136 0a31 370a 3138 0a31 390a .15.16.17.18.19.', | |
178 \ '00000048: 3230 0a32 310a 3232 0a32 330a 3234 0a32 20.21.22.23.24.2', | |
179 \ '00000064: 350a 3236 0a32 370a 3238 0a32 390a 3330 5.26.27.28.29.30', | |
180 \ '00000080: 0a .'] | |
181 call assert_equal(expected, getline(1,'$'), s:Mess(s:test)) | |
182 | |
183 " Test 14: grouping with -d | |
184 let s:test += 1 | |
185 let expected = [ | |
186 \ '00000000: 310a320a 330a340a 350a360a 370a380a 1.2.3.4.5.6.7.8.', | |
187 \ '00000016: 390a3130 0a31310a 31320a31 330a3134 9.10.11.12.13.14', | |
188 \ '00000032: 0a31350a 31360a31 370a3138 0a31390a .15.16.17.18.19.', | |
189 \ '00000048: 32300a32 310a3232 0a32330a 32340a32 20.21.22.23.24.2', | |
190 \ '00000064: 350a3236 0a32370a 32380a32 390a3330 5.26.27.28.29.30', | |
191 \ '00000080: 0a .'] | |
192 for arg in ['-g 4', '-group 4', '-g4'] | |
193 exe '%!' . s:xxd_cmd . ' ' . arg . ' -d %' | |
194 call assert_equal(expected, getline(1,'$'), s:Mess(s:test)) | |
195 endfor | |
196 | |
197 " Test 15: cols with decimal offset: -c 21 -d | |
198 let s:test += 1 | |
199 let expected = [ | |
200 \ '00000000: 310a 320a 330a 340a 350a 360a 370a 380a 390a 3130 0a 1.2.3.4.5.6.7.8.9.10.', | |
201 \ '00000021: 3131 0a31 320a 3133 0a31 340a 3135 0a31 360a 3137 0a 11.12.13.14.15.16.17.', | |
202 \ '00000042: 3138 0a31 390a 3230 0a32 310a 3232 0a32 330a 3234 0a 18.19.20.21.22.23.24.', | |
203 \ '00000063: 3235 0a32 360a 3237 0a32 380a 3239 0a33 300a 25.26.27.28.29.30.'] | |
204 exe '%!' . s:xxd_cmd . ' -c 21 -d %' | |
205 call assert_equal(expected, getline(1,'$'), s:Mess(s:test)) | |
206 | |
168 " TODO: | 207 " TODO: |
169 " -o -offset | 208 " -o -offset |
170 | 209 |
171 %d | 210 %d |
172 bw! | 211 bw! |