annotate src/testdir/test_xxd.vim @ 35189:945f1fec1802 default tip

runtime(doc): clarify instal instructions for comment package Commit: https://github.com/vim/vim/commit/e595e9c31b651bcb15d2f40ff00fffa432370484 Author: Christian Brabandt <cb@256bit.org> Date: Fri May 17 17:29:37 2024 +0200 runtime(doc): clarify instal instructions for comment package Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Fri, 17 May 2024 17:45:10 +0200
parents b2ea090aea59
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13634
2678e38e1de6 patch 8.0.1689: no tests for xxd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Test for the xxd command
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 20784
diff changeset
2
33083
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
3 source check.vim
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
4 source screendump.vim
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
5
13646
86eb21bb5920 patch 8.0.1695: xxd test not run on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 13638
diff changeset
6 if empty($XXD) && executable('..\xxd\xxd.exe')
86eb21bb5920 patch 8.0.1695: xxd test not run on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 13638
diff changeset
7 let s:xxd_cmd = '..\xxd\xxd.exe'
86eb21bb5920 patch 8.0.1695: xxd test not run on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 13638
diff changeset
8 elseif empty($XXD) || !executable($XXD)
17089
8e9e9124c7a2 patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents: 17049
diff changeset
9 throw 'Skipped: xxd program missing'
13646
86eb21bb5920 patch 8.0.1695: xxd test not run on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 13638
diff changeset
10 else
86eb21bb5920 patch 8.0.1695: xxd test not run on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 13638
diff changeset
11 let s:xxd_cmd = $XXD
13634
2678e38e1de6 patch 8.0.1689: no tests for xxd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 endif
2678e38e1de6 patch 8.0.1689: no tests for xxd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13963
diff changeset
14 func PrepareBuffer(lines)
13638
b3068807f5df patch 8.0.1691: xxd test sometimes fails
Christian Brabandt <cb@256bit.org>
parents: 13634
diff changeset
15 new
b3068807f5df patch 8.0.1691: xxd test sometimes fails
Christian Brabandt <cb@256bit.org>
parents: 13634
diff changeset
16 call append(0, a:lines)
13634
2678e38e1de6 patch 8.0.1689: no tests for xxd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 $d
2678e38e1de6 patch 8.0.1689: no tests for xxd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 endfunc
2678e38e1de6 patch 8.0.1689: no tests for xxd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13963
diff changeset
20 func s:Mess(counter)
13634
2678e38e1de6 patch 8.0.1689: no tests for xxd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 return printf("Failed xxd test %d:", a:counter)
2678e38e1de6 patch 8.0.1689: no tests for xxd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 endfunc
2678e38e1de6 patch 8.0.1689: no tests for xxd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13963
diff changeset
24 func Test_xxd()
13634
2678e38e1de6 patch 8.0.1689: no tests for xxd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 call PrepareBuffer(range(1,30))
13646
86eb21bb5920 patch 8.0.1695: xxd test not run on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 13638
diff changeset
26 set ff=unix
15627
11879b89bb69 patch 8.1.0821: xxd "usage" output and other arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
27 w! XXDfile
13638
b3068807f5df patch 8.0.1691: xxd test sometimes fails
Christian Brabandt <cb@256bit.org>
parents: 13634
diff changeset
28
13634
2678e38e1de6 patch 8.0.1689: no tests for xxd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 " Test 1: simple, filter the result through xxd
2678e38e1de6 patch 8.0.1689: no tests for xxd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 let s:test = 1
13646
86eb21bb5920 patch 8.0.1695: xxd test not run on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 13638
diff changeset
31 exe '%!' . s:xxd_cmd . ' %'
13634
2678e38e1de6 patch 8.0.1689: no tests for xxd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 let expected = [
2678e38e1de6 patch 8.0.1689: no tests for xxd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 \ '00000000: 310a 320a 330a 340a 350a 360a 370a 380a 1.2.3.4.5.6.7.8.',
2678e38e1de6 patch 8.0.1689: no tests for xxd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34 \ '00000010: 390a 3130 0a31 310a 3132 0a31 330a 3134 9.10.11.12.13.14',
2678e38e1de6 patch 8.0.1689: no tests for xxd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35 \ '00000020: 0a31 350a 3136 0a31 370a 3138 0a31 390a .15.16.17.18.19.',
2678e38e1de6 patch 8.0.1689: no tests for xxd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36 \ '00000030: 3230 0a32 310a 3232 0a32 330a 3234 0a32 20.21.22.23.24.2',
2678e38e1de6 patch 8.0.1689: no tests for xxd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37 \ '00000040: 350a 3236 0a32 370a 3238 0a32 390a 3330 5.26.27.28.29.30',
2678e38e1de6 patch 8.0.1689: no tests for xxd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
38 \ '00000050: 0a .']
2678e38e1de6 patch 8.0.1689: no tests for xxd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
39 call assert_equal(expected, getline(1,'$'), s:Mess(s:test))
13638
b3068807f5df patch 8.0.1691: xxd test sometimes fails
Christian Brabandt <cb@256bit.org>
parents: 13634
diff changeset
40
13634
2678e38e1de6 patch 8.0.1689: no tests for xxd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41 " Test 2: reverse the result
2678e38e1de6 patch 8.0.1689: no tests for xxd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42 let s:test += 1
13646
86eb21bb5920 patch 8.0.1695: xxd test not run on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 13638
diff changeset
43 exe '%!' . s:xxd_cmd . ' -r'
13634
2678e38e1de6 patch 8.0.1689: no tests for xxd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44 call assert_equal(map(range(1,30), {v,c -> string(c)}), getline(1,'$'), s:Mess(s:test))
2678e38e1de6 patch 8.0.1689: no tests for xxd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45
15627
11879b89bb69 patch 8.1.0821: xxd "usage" output and other arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
46 " Test 3: Skip the first 0x30 bytes
13634
2678e38e1de6 patch 8.0.1689: no tests for xxd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
47 let s:test += 1
15627
11879b89bb69 patch 8.1.0821: xxd "usage" output and other arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
48 for arg in ['-s 0x30', '-s0x30', '-s+0x30', '-skip 0x030', '-seek 0x30', '-seek +0x30 --']
11879b89bb69 patch 8.1.0821: xxd "usage" output and other arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
49 exe '%!' . s:xxd_cmd . ' ' . arg . ' %'
11879b89bb69 patch 8.1.0821: xxd "usage" output and other arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
50 call assert_equal(expected[3:], getline(1,'$'), s:Mess(s:test))
11879b89bb69 patch 8.1.0821: xxd "usage" output and other arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
51 endfor
13634
2678e38e1de6 patch 8.0.1689: no tests for xxd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
52
2678e38e1de6 patch 8.0.1689: no tests for xxd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
53 " Test 4: Skip the first 30 bytes
2678e38e1de6 patch 8.0.1689: no tests for xxd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
54 let s:test += 1
15627
11879b89bb69 patch 8.1.0821: xxd "usage" output and other arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
55 for arg in ['-s -0x31', '-s-0x31']
11879b89bb69 patch 8.1.0821: xxd "usage" output and other arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
56 exe '%!' . s:xxd_cmd . ' ' . arg . ' %'
11879b89bb69 patch 8.1.0821: xxd "usage" output and other arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
57 call assert_equal(expected[2:], getline(1,'$'), s:Mess(s:test))
11879b89bb69 patch 8.1.0821: xxd "usage" output and other arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
58 endfor
13634
2678e38e1de6 patch 8.0.1689: no tests for xxd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
59
15647
f7b88b1d3350 patch 8.1.0831: xxd test fails if man page has dos fileformat
Bram Moolenaar <Bram@vim.org>
parents: 15630
diff changeset
60 " The following tests use the xxd man page.
f7b88b1d3350 patch 8.1.0831: xxd test fails if man page has dos fileformat
Bram Moolenaar <Bram@vim.org>
parents: 15630
diff changeset
61 " For these tests to pass, the fileformat must be "unix".
f7b88b1d3350 patch 8.1.0831: xxd test fails if man page has dos fileformat
Bram Moolenaar <Bram@vim.org>
parents: 15630
diff changeset
62 let man_copy = 'Xxd.1'
f7b88b1d3350 patch 8.1.0831: xxd test fails if man page has dos fileformat
Bram Moolenaar <Bram@vim.org>
parents: 15630
diff changeset
63 let man_page = '../../runtime/doc/xxd.1'
f7b88b1d3350 patch 8.1.0831: xxd test fails if man page has dos fileformat
Bram Moolenaar <Bram@vim.org>
parents: 15630
diff changeset
64 if has('win32') && !filereadable(man_page)
f7b88b1d3350 patch 8.1.0831: xxd test fails if man page has dos fileformat
Bram Moolenaar <Bram@vim.org>
parents: 15630
diff changeset
65 let man_page = '../../doc/xxd.1'
f7b88b1d3350 patch 8.1.0831: xxd test fails if man page has dos fileformat
Bram Moolenaar <Bram@vim.org>
parents: 15630
diff changeset
66 endif
f7b88b1d3350 patch 8.1.0831: xxd test fails if man page has dos fileformat
Bram Moolenaar <Bram@vim.org>
parents: 15630
diff changeset
67 %d
f7b88b1d3350 patch 8.1.0831: xxd test fails if man page has dos fileformat
Bram Moolenaar <Bram@vim.org>
parents: 15630
diff changeset
68 exe '0r ' man_page '| set ff=unix | $d | w' man_copy '| bwipe!' man_copy
f7b88b1d3350 patch 8.1.0831: xxd test fails if man page has dos fileformat
Bram Moolenaar <Bram@vim.org>
parents: 15630
diff changeset
69
13634
2678e38e1de6 patch 8.0.1689: no tests for xxd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
70 " Test 5: Print 120 bytes as continuous hexdump with 20 octets per line
2678e38e1de6 patch 8.0.1689: no tests for xxd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
71 let s:test += 1
2678e38e1de6 patch 8.0.1689: no tests for xxd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
72 %d
15647
f7b88b1d3350 patch 8.1.0831: xxd test fails if man page has dos fileformat
Bram Moolenaar <Bram@vim.org>
parents: 15630
diff changeset
73 exe '0r! ' . s:xxd_cmd . ' -l 120 -ps -c20 ' . man_copy
13634
2678e38e1de6 patch 8.0.1689: no tests for xxd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
74 $d
2678e38e1de6 patch 8.0.1689: no tests for xxd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
75 let expected = [
2678e38e1de6 patch 8.0.1689: no tests for xxd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
76 \ '2e54482058584420312022417567757374203139',
2678e38e1de6 patch 8.0.1689: no tests for xxd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
77 \ '39362220224d616e75616c207061676520666f72',
2678e38e1de6 patch 8.0.1689: no tests for xxd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
78 \ '20787864220a2e5c220a2e5c222032317374204d',
2678e38e1de6 patch 8.0.1689: no tests for xxd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
79 \ '617920313939360a2e5c22204d616e2070616765',
2678e38e1de6 patch 8.0.1689: no tests for xxd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
80 \ '20617574686f723a0a2e5c2220202020546f6e79',
2678e38e1de6 patch 8.0.1689: no tests for xxd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
81 \ '204e7567656e74203c746f6e79407363746e7567']
2678e38e1de6 patch 8.0.1689: no tests for xxd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
82 call assert_equal(expected, getline(1,'$'), s:Mess(s:test))
13638
b3068807f5df patch 8.0.1691: xxd test sometimes fails
Christian Brabandt <cb@256bit.org>
parents: 13634
diff changeset
83
13634
2678e38e1de6 patch 8.0.1689: no tests for xxd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
84 " Test 6: Print the date from xxd.1
2678e38e1de6 patch 8.0.1689: no tests for xxd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
85 let s:test += 1
15627
11879b89bb69 patch 8.1.0821: xxd "usage" output and other arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
86 for arg in ['-l 13', '-l13', '-len 13']
11879b89bb69 patch 8.1.0821: xxd "usage" output and other arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
87 %d
15647
f7b88b1d3350 patch 8.1.0831: xxd test fails if man page has dos fileformat
Bram Moolenaar <Bram@vim.org>
parents: 15630
diff changeset
88 exe '0r! ' . s:xxd_cmd . ' -s 0x36 ' . arg . ' -cols 13 ' . man_copy
15627
11879b89bb69 patch 8.1.0821: xxd "usage" output and other arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
89 $d
11879b89bb69 patch 8.1.0821: xxd "usage" output and other arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
90 call assert_equal('00000036: 3231 7374 204d 6179 2031 3939 36 21st May 1996', getline(1), s:Mess(s:test))
11879b89bb69 patch 8.1.0821: xxd "usage" output and other arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
91 endfor
13638
b3068807f5df patch 8.0.1691: xxd test sometimes fails
Christian Brabandt <cb@256bit.org>
parents: 13634
diff changeset
92
15647
f7b88b1d3350 patch 8.1.0831: xxd test fails if man page has dos fileformat
Bram Moolenaar <Bram@vim.org>
parents: 15630
diff changeset
93 " Cleanup after tests 5 and 6
f7b88b1d3350 patch 8.1.0831: xxd test fails if man page has dos fileformat
Bram Moolenaar <Bram@vim.org>
parents: 15630
diff changeset
94 call delete(man_copy)
f7b88b1d3350 patch 8.1.0831: xxd test fails if man page has dos fileformat
Bram Moolenaar <Bram@vim.org>
parents: 15630
diff changeset
95
13634
2678e38e1de6 patch 8.0.1689: no tests for xxd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
96 " Test 7: Print C include
2678e38e1de6 patch 8.0.1689: no tests for xxd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
97 let s:test += 1
2678e38e1de6 patch 8.0.1689: no tests for xxd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
98 call writefile(['TESTabcd09'], 'XXDfile')
2678e38e1de6 patch 8.0.1689: no tests for xxd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
99 %d
13646
86eb21bb5920 patch 8.0.1695: xxd test not run on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 13638
diff changeset
100 exe '0r! ' . s:xxd_cmd . ' -i XXDfile'
13634
2678e38e1de6 patch 8.0.1689: no tests for xxd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
101 $d
16720
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 15647
diff changeset
102 let expected =<< trim [CODE]
17172
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
103 unsigned char XXDfile[] = {
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
104 0x54, 0x45, 0x53, 0x54, 0x61, 0x62, 0x63, 0x64, 0x30, 0x39, 0x0a
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
105 };
34207
5aee5855ccfe patch 9.1.0052: Patch 9.1.0041 causes regressions for users
Christian Brabandt <cb@256bit.org>
parents: 34165
diff changeset
106 unsigned int XXDfile_len = 11;
16720
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 15647
diff changeset
107 [CODE]
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 15647
diff changeset
108
13634
2678e38e1de6 patch 8.0.1689: no tests for xxd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
109 call assert_equal(expected, getline(1,'$'), s:Mess(s:test))
13638
b3068807f5df patch 8.0.1691: xxd test sometimes fails
Christian Brabandt <cb@256bit.org>
parents: 13634
diff changeset
110
13634
2678e38e1de6 patch 8.0.1689: no tests for xxd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
111 " Test 8: Print C include capitalized
2678e38e1de6 patch 8.0.1689: no tests for xxd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
112 let s:test += 1
15627
11879b89bb69 patch 8.1.0821: xxd "usage" output and other arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
113 for arg in ['-C', '-capitalize']
11879b89bb69 patch 8.1.0821: xxd "usage" output and other arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
114 call writefile(['TESTabcd09'], 'XXDfile')
11879b89bb69 patch 8.1.0821: xxd "usage" output and other arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
115 %d
11879b89bb69 patch 8.1.0821: xxd "usage" output and other arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
116 exe '0r! ' . s:xxd_cmd . ' -i ' . arg . ' XXDfile'
11879b89bb69 patch 8.1.0821: xxd "usage" output and other arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
117 $d
16720
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 15647
diff changeset
118 let expected =<< trim [CODE]
17172
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
119 unsigned char XXDFILE[] = {
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
120 0x54, 0x45, 0x53, 0x54, 0x61, 0x62, 0x63, 0x64, 0x30, 0x39, 0x0a
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
121 };
34207
5aee5855ccfe patch 9.1.0052: Patch 9.1.0041 causes regressions for users
Christian Brabandt <cb@256bit.org>
parents: 34165
diff changeset
122 unsigned int XXDFILE_LEN = 11;
16720
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 15647
diff changeset
123 [CODE]
15627
11879b89bb69 patch 8.1.0821: xxd "usage" output and other arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
124 call assert_equal(expected, getline(1,'$'), s:Mess(s:test))
11879b89bb69 patch 8.1.0821: xxd "usage" output and other arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
125 endfor
13638
b3068807f5df patch 8.0.1691: xxd test sometimes fails
Christian Brabandt <cb@256bit.org>
parents: 13634
diff changeset
126
b3068807f5df patch 8.0.1691: xxd test sometimes fails
Christian Brabandt <cb@256bit.org>
parents: 13634
diff changeset
127 " Test 9: Create a file with containing a single 'A'
13634
2678e38e1de6 patch 8.0.1689: no tests for xxd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
128 let s:test += 1
2678e38e1de6 patch 8.0.1689: no tests for xxd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
129 call delete('XXDfile')
13638
b3068807f5df patch 8.0.1691: xxd test sometimes fails
Christian Brabandt <cb@256bit.org>
parents: 13634
diff changeset
130 bwipe! XXDfile
13646
86eb21bb5920 patch 8.0.1695: xxd test not run on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 13638
diff changeset
131 if has('unix')
86eb21bb5920 patch 8.0.1695: xxd test not run on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 13638
diff changeset
132 call system('echo "010000: 41"|' . s:xxd_cmd . ' -r -s -0x10000 > XXDfile')
86eb21bb5920 patch 8.0.1695: xxd test not run on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 13638
diff changeset
133 else
86eb21bb5920 patch 8.0.1695: xxd test not run on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 13638
diff changeset
134 call writefile(['010000: 41'], 'Xinput')
86eb21bb5920 patch 8.0.1695: xxd test not run on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 13638
diff changeset
135 silent exe '!' . s:xxd_cmd . ' -r -s -0x10000 < Xinput > XXDfile'
86eb21bb5920 patch 8.0.1695: xxd test not run on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 13638
diff changeset
136 call delete('Xinput')
86eb21bb5920 patch 8.0.1695: xxd test not run on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 13638
diff changeset
137 endif
13634
2678e38e1de6 patch 8.0.1689: no tests for xxd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
138 call PrepareBuffer(readfile('XXDfile')[0])
2678e38e1de6 patch 8.0.1689: no tests for xxd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
139 call assert_equal('A', getline(1), s:Mess(s:test))
2678e38e1de6 patch 8.0.1689: no tests for xxd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
140 call delete('XXDfile')
15627
11879b89bb69 patch 8.1.0821: xxd "usage" output and other arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
141
11879b89bb69 patch 8.1.0821: xxd "usage" output and other arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
142 " Test 10: group with 4 octets
11879b89bb69 patch 8.1.0821: xxd "usage" output and other arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
143 let s:test += 1
11879b89bb69 patch 8.1.0821: xxd "usage" output and other arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
144 for arg in ['-g 4', '-group 4', '-g4']
11879b89bb69 patch 8.1.0821: xxd "usage" output and other arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
145 call writefile(['TESTabcd09'], 'XXDfile')
11879b89bb69 patch 8.1.0821: xxd "usage" output and other arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
146 %d
11879b89bb69 patch 8.1.0821: xxd "usage" output and other arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
147 exe '0r! ' . s:xxd_cmd . ' ' . arg . ' XXDfile'
11879b89bb69 patch 8.1.0821: xxd "usage" output and other arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
148 $d
11879b89bb69 patch 8.1.0821: xxd "usage" output and other arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
149 let expected = ['00000000: 54455354 61626364 30390a TESTabcd09.']
11879b89bb69 patch 8.1.0821: xxd "usage" output and other arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
150 call assert_equal(expected, getline(1,'$'), s:Mess(s:test))
11879b89bb69 patch 8.1.0821: xxd "usage" output and other arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
151 call delete('XXDfile')
11879b89bb69 patch 8.1.0821: xxd "usage" output and other arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
152 endfor
11879b89bb69 patch 8.1.0821: xxd "usage" output and other arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
153
15630
db6cfc44eb65 patch 8.1.0823: not sufficient testing of xxd
Bram Moolenaar <Bram@vim.org>
parents: 15627
diff changeset
154 " Test 11: reverse with CR, hex upper, Postscript style with a TAB
db6cfc44eb65 patch 8.1.0823: not sufficient testing of xxd
Bram Moolenaar <Bram@vim.org>
parents: 15627
diff changeset
155 let s:test += 1
db6cfc44eb65 patch 8.1.0823: not sufficient testing of xxd
Bram Moolenaar <Bram@vim.org>
parents: 15627
diff changeset
156 call writefile([" 54455354\t610B6364 30390A TESTa\0x0bcd09.\r"], 'Xinput')
db6cfc44eb65 patch 8.1.0823: not sufficient testing of xxd
Bram Moolenaar <Bram@vim.org>
parents: 15627
diff changeset
157 silent exe '!' . s:xxd_cmd . ' -r -p < Xinput > XXDfile'
db6cfc44eb65 patch 8.1.0823: not sufficient testing of xxd
Bram Moolenaar <Bram@vim.org>
parents: 15627
diff changeset
158 let blob = readfile('XXDfile', 'B')
db6cfc44eb65 patch 8.1.0823: not sufficient testing of xxd
Bram Moolenaar <Bram@vim.org>
parents: 15627
diff changeset
159 call assert_equal(0z54455354.610B6364.30390A, blob)
db6cfc44eb65 patch 8.1.0823: not sufficient testing of xxd
Bram Moolenaar <Bram@vim.org>
parents: 15627
diff changeset
160 call delete('Xinput')
db6cfc44eb65 patch 8.1.0823: not sufficient testing of xxd
Bram Moolenaar <Bram@vim.org>
parents: 15627
diff changeset
161 call delete('XXDfile')
db6cfc44eb65 patch 8.1.0823: not sufficient testing of xxd
Bram Moolenaar <Bram@vim.org>
parents: 15627
diff changeset
162
db6cfc44eb65 patch 8.1.0823: not sufficient testing of xxd
Bram Moolenaar <Bram@vim.org>
parents: 15627
diff changeset
163 " Test 12: reverse with seek
db6cfc44eb65 patch 8.1.0823: not sufficient testing of xxd
Bram Moolenaar <Bram@vim.org>
parents: 15627
diff changeset
164 let s:test += 1
db6cfc44eb65 patch 8.1.0823: not sufficient testing of xxd
Bram Moolenaar <Bram@vim.org>
parents: 15627
diff changeset
165 call writefile(["00000000: 54455354\t610B6364 30390A TESTa\0x0bcd09.\r"], 'Xinput')
db6cfc44eb65 patch 8.1.0823: not sufficient testing of xxd
Bram Moolenaar <Bram@vim.org>
parents: 15627
diff changeset
166 silent exe '!' . s:xxd_cmd . ' -r -seek 5 < Xinput > XXDfile'
db6cfc44eb65 patch 8.1.0823: not sufficient testing of xxd
Bram Moolenaar <Bram@vim.org>
parents: 15627
diff changeset
167 let blob = readfile('XXDfile', 'B')
db6cfc44eb65 patch 8.1.0823: not sufficient testing of xxd
Bram Moolenaar <Bram@vim.org>
parents: 15627
diff changeset
168 call assert_equal(0z0000000000.54455354.610B6364.30390A, blob)
db6cfc44eb65 patch 8.1.0823: not sufficient testing of xxd
Bram Moolenaar <Bram@vim.org>
parents: 15627
diff changeset
169 call delete('Xinput')
db6cfc44eb65 patch 8.1.0823: not sufficient testing of xxd
Bram Moolenaar <Bram@vim.org>
parents: 15627
diff changeset
170 call delete('XXDfile')
db6cfc44eb65 patch 8.1.0823: not sufficient testing of xxd
Bram Moolenaar <Bram@vim.org>
parents: 15627
diff changeset
171
20601
75ef263d09d6 patch 8.2.0854: xxd cannot show offset as a decimal number
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
172 " Test 13: simple, decimal offset
75ef263d09d6 patch 8.2.0854: xxd cannot show offset as a decimal number
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
173 call PrepareBuffer(range(1,30))
75ef263d09d6 patch 8.2.0854: xxd cannot show offset as a decimal number
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
174 set ff=unix
75ef263d09d6 patch 8.2.0854: xxd cannot show offset as a decimal number
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
175 w! XXDfile
75ef263d09d6 patch 8.2.0854: xxd cannot show offset as a decimal number
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
176 let s:test += 1
75ef263d09d6 patch 8.2.0854: xxd cannot show offset as a decimal number
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
177 exe '%!' . s:xxd_cmd . ' -d %'
75ef263d09d6 patch 8.2.0854: xxd cannot show offset as a decimal number
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
178 let expected = [
75ef263d09d6 patch 8.2.0854: xxd cannot show offset as a decimal number
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
179 \ '00000000: 310a 320a 330a 340a 350a 360a 370a 380a 1.2.3.4.5.6.7.8.',
75ef263d09d6 patch 8.2.0854: xxd cannot show offset as a decimal number
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
180 \ '00000016: 390a 3130 0a31 310a 3132 0a31 330a 3134 9.10.11.12.13.14',
75ef263d09d6 patch 8.2.0854: xxd cannot show offset as a decimal number
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
181 \ '00000032: 0a31 350a 3136 0a31 370a 3138 0a31 390a .15.16.17.18.19.',
75ef263d09d6 patch 8.2.0854: xxd cannot show offset as a decimal number
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
182 \ '00000048: 3230 0a32 310a 3232 0a32 330a 3234 0a32 20.21.22.23.24.2',
75ef263d09d6 patch 8.2.0854: xxd cannot show offset as a decimal number
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
183 \ '00000064: 350a 3236 0a32 370a 3238 0a32 390a 3330 5.26.27.28.29.30',
75ef263d09d6 patch 8.2.0854: xxd cannot show offset as a decimal number
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
184 \ '00000080: 0a .']
75ef263d09d6 patch 8.2.0854: xxd cannot show offset as a decimal number
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
185 call assert_equal(expected, getline(1,'$'), s:Mess(s:test))
75ef263d09d6 patch 8.2.0854: xxd cannot show offset as a decimal number
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
186
75ef263d09d6 patch 8.2.0854: xxd cannot show offset as a decimal number
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
187 " Test 14: grouping with -d
75ef263d09d6 patch 8.2.0854: xxd cannot show offset as a decimal number
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
188 let s:test += 1
75ef263d09d6 patch 8.2.0854: xxd cannot show offset as a decimal number
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
189 let expected = [
75ef263d09d6 patch 8.2.0854: xxd cannot show offset as a decimal number
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
190 \ '00000000: 310a320a 330a340a 350a360a 370a380a 1.2.3.4.5.6.7.8.',
75ef263d09d6 patch 8.2.0854: xxd cannot show offset as a decimal number
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
191 \ '00000016: 390a3130 0a31310a 31320a31 330a3134 9.10.11.12.13.14',
75ef263d09d6 patch 8.2.0854: xxd cannot show offset as a decimal number
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
192 \ '00000032: 0a31350a 31360a31 370a3138 0a31390a .15.16.17.18.19.',
75ef263d09d6 patch 8.2.0854: xxd cannot show offset as a decimal number
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
193 \ '00000048: 32300a32 310a3232 0a32330a 32340a32 20.21.22.23.24.2',
75ef263d09d6 patch 8.2.0854: xxd cannot show offset as a decimal number
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
194 \ '00000064: 350a3236 0a32370a 32380a32 390a3330 5.26.27.28.29.30',
75ef263d09d6 patch 8.2.0854: xxd cannot show offset as a decimal number
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
195 \ '00000080: 0a .']
75ef263d09d6 patch 8.2.0854: xxd cannot show offset as a decimal number
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
196 for arg in ['-g 4', '-group 4', '-g4']
75ef263d09d6 patch 8.2.0854: xxd cannot show offset as a decimal number
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
197 exe '%!' . s:xxd_cmd . ' ' . arg . ' -d %'
75ef263d09d6 patch 8.2.0854: xxd cannot show offset as a decimal number
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
198 call assert_equal(expected, getline(1,'$'), s:Mess(s:test))
75ef263d09d6 patch 8.2.0854: xxd cannot show offset as a decimal number
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
199 endfor
75ef263d09d6 patch 8.2.0854: xxd cannot show offset as a decimal number
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
200
75ef263d09d6 patch 8.2.0854: xxd cannot show offset as a decimal number
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
201 " Test 15: cols with decimal offset: -c 21 -d
75ef263d09d6 patch 8.2.0854: xxd cannot show offset as a decimal number
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
202 let s:test += 1
75ef263d09d6 patch 8.2.0854: xxd cannot show offset as a decimal number
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
203 let expected = [
75ef263d09d6 patch 8.2.0854: xxd cannot show offset as a decimal number
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
204 \ '00000000: 310a 320a 330a 340a 350a 360a 370a 380a 390a 3130 0a 1.2.3.4.5.6.7.8.9.10.',
75ef263d09d6 patch 8.2.0854: xxd cannot show offset as a decimal number
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
205 \ '00000021: 3131 0a31 320a 3133 0a31 340a 3135 0a31 360a 3137 0a 11.12.13.14.15.16.17.',
75ef263d09d6 patch 8.2.0854: xxd cannot show offset as a decimal number
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
206 \ '00000042: 3138 0a31 390a 3230 0a32 310a 3232 0a32 330a 3234 0a 18.19.20.21.22.23.24.',
75ef263d09d6 patch 8.2.0854: xxd cannot show offset as a decimal number
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
207 \ '00000063: 3235 0a32 360a 3237 0a32 380a 3239 0a33 300a 25.26.27.28.29.30.']
75ef263d09d6 patch 8.2.0854: xxd cannot show offset as a decimal number
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
208 exe '%!' . s:xxd_cmd . ' -c 21 -d %'
75ef263d09d6 patch 8.2.0854: xxd cannot show offset as a decimal number
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
209 call assert_equal(expected, getline(1,'$'), s:Mess(s:test))
75ef263d09d6 patch 8.2.0854: xxd cannot show offset as a decimal number
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
210
27102
4061623aa316 patch 8.2.4080: not sufficient test coverage for xxd
Bram Moolenaar <Bram@vim.org>
parents: 26254
diff changeset
211 " Test 16: -o -offset
4061623aa316 patch 8.2.4080: not sufficient test coverage for xxd
Bram Moolenaar <Bram@vim.org>
parents: 26254
diff changeset
212 let s:test += 1
4061623aa316 patch 8.2.4080: not sufficient test coverage for xxd
Bram Moolenaar <Bram@vim.org>
parents: 26254
diff changeset
213 let expected = [
4061623aa316 patch 8.2.4080: not sufficient test coverage for xxd
Bram Moolenaar <Bram@vim.org>
parents: 26254
diff changeset
214 \ '0000000f: 310a 320a 330a 340a 350a 360a 370a 380a 1.2.3.4.5.6.7.8.',
4061623aa316 patch 8.2.4080: not sufficient test coverage for xxd
Bram Moolenaar <Bram@vim.org>
parents: 26254
diff changeset
215 \ '0000001f: 390a 3130 0a31 310a 3132 0a31 330a 3134 9.10.11.12.13.14',
4061623aa316 patch 8.2.4080: not sufficient test coverage for xxd
Bram Moolenaar <Bram@vim.org>
parents: 26254
diff changeset
216 \ '0000002f: 0a31 350a 3136 0a31 370a 3138 0a31 390a .15.16.17.18.19.',
4061623aa316 patch 8.2.4080: not sufficient test coverage for xxd
Bram Moolenaar <Bram@vim.org>
parents: 26254
diff changeset
217 \ '0000003f: 3230 0a32 310a 3232 0a32 330a 3234 0a32 20.21.22.23.24.2',
4061623aa316 patch 8.2.4080: not sufficient test coverage for xxd
Bram Moolenaar <Bram@vim.org>
parents: 26254
diff changeset
218 \ '0000004f: 350a 3236 0a32 370a 3238 0a32 390a 3330 5.26.27.28.29.30',
4061623aa316 patch 8.2.4080: not sufficient test coverage for xxd
Bram Moolenaar <Bram@vim.org>
parents: 26254
diff changeset
219 \ '0000005f: 0a .']
4061623aa316 patch 8.2.4080: not sufficient test coverage for xxd
Bram Moolenaar <Bram@vim.org>
parents: 26254
diff changeset
220 for arg in ['-o 15', '-offset 15', '-o15']
4061623aa316 patch 8.2.4080: not sufficient test coverage for xxd
Bram Moolenaar <Bram@vim.org>
parents: 26254
diff changeset
221 exe '%!' . s:xxd_cmd . ' ' . arg . ' %'
4061623aa316 patch 8.2.4080: not sufficient test coverage for xxd
Bram Moolenaar <Bram@vim.org>
parents: 26254
diff changeset
222 call assert_equal(expected, getline(1,'$'), s:Mess(s:test))
4061623aa316 patch 8.2.4080: not sufficient test coverage for xxd
Bram Moolenaar <Bram@vim.org>
parents: 26254
diff changeset
223 endfor
15627
11879b89bb69 patch 8.1.0821: xxd "usage" output and other arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
224
29330
948c947cb1ed patch 9.0.0008: cannot specify the variable name for "xxd -i"
Bram Moolenaar <Bram@vim.org>
parents: 27118
diff changeset
225 " Test 17: Print C include with custom variable name
948c947cb1ed patch 9.0.0008: cannot specify the variable name for "xxd -i"
Bram Moolenaar <Bram@vim.org>
parents: 27118
diff changeset
226 let s:test += 1
948c947cb1ed patch 9.0.0008: cannot specify the variable name for "xxd -i"
Bram Moolenaar <Bram@vim.org>
parents: 27118
diff changeset
227 call writefile(['TESTabcd09'], 'XXDfile')
948c947cb1ed patch 9.0.0008: cannot specify the variable name for "xxd -i"
Bram Moolenaar <Bram@vim.org>
parents: 27118
diff changeset
228 for arg in ['-nvarName', '-n varName', '-name varName']
948c947cb1ed patch 9.0.0008: cannot specify the variable name for "xxd -i"
Bram Moolenaar <Bram@vim.org>
parents: 27118
diff changeset
229 %d
948c947cb1ed patch 9.0.0008: cannot specify the variable name for "xxd -i"
Bram Moolenaar <Bram@vim.org>
parents: 27118
diff changeset
230 exe '0r! ' . s:xxd_cmd . ' -i ' . arg . ' XXDfile'
948c947cb1ed patch 9.0.0008: cannot specify the variable name for "xxd -i"
Bram Moolenaar <Bram@vim.org>
parents: 27118
diff changeset
231 $d
948c947cb1ed patch 9.0.0008: cannot specify the variable name for "xxd -i"
Bram Moolenaar <Bram@vim.org>
parents: 27118
diff changeset
232 let expected =<< trim [CODE]
948c947cb1ed patch 9.0.0008: cannot specify the variable name for "xxd -i"
Bram Moolenaar <Bram@vim.org>
parents: 27118
diff changeset
233 unsigned char varName[] = {
948c947cb1ed patch 9.0.0008: cannot specify the variable name for "xxd -i"
Bram Moolenaar <Bram@vim.org>
parents: 27118
diff changeset
234 0x54, 0x45, 0x53, 0x54, 0x61, 0x62, 0x63, 0x64, 0x30, 0x39, 0x0a
948c947cb1ed patch 9.0.0008: cannot specify the variable name for "xxd -i"
Bram Moolenaar <Bram@vim.org>
parents: 27118
diff changeset
235 };
34207
5aee5855ccfe patch 9.1.0052: Patch 9.1.0041 causes regressions for users
Christian Brabandt <cb@256bit.org>
parents: 34165
diff changeset
236 unsigned int varName_len = 11;
29330
948c947cb1ed patch 9.0.0008: cannot specify the variable name for "xxd -i"
Bram Moolenaar <Bram@vim.org>
parents: 27118
diff changeset
237 [CODE]
31849
dbec60b8c253 patch 9.0.1257: code style is not check in test scripts
Bram Moolenaar <Bram@vim.org>
parents: 30869
diff changeset
238
29330
948c947cb1ed patch 9.0.0008: cannot specify the variable name for "xxd -i"
Bram Moolenaar <Bram@vim.org>
parents: 27118
diff changeset
239 call assert_equal(expected, getline(1,'$'), s:Mess(s:test))
948c947cb1ed patch 9.0.0008: cannot specify the variable name for "xxd -i"
Bram Moolenaar <Bram@vim.org>
parents: 27118
diff changeset
240 endfor
948c947cb1ed patch 9.0.0008: cannot specify the variable name for "xxd -i"
Bram Moolenaar <Bram@vim.org>
parents: 27118
diff changeset
241
948c947cb1ed patch 9.0.0008: cannot specify the variable name for "xxd -i"
Bram Moolenaar <Bram@vim.org>
parents: 27118
diff changeset
242 " using "-n name" reading from stdin
948c947cb1ed patch 9.0.0008: cannot specify the variable name for "xxd -i"
Bram Moolenaar <Bram@vim.org>
parents: 27118
diff changeset
243 %d
948c947cb1ed patch 9.0.0008: cannot specify the variable name for "xxd -i"
Bram Moolenaar <Bram@vim.org>
parents: 27118
diff changeset
244 exe '0r! ' . s:xxd_cmd . ' -i < XXDfile -n StdIn'
948c947cb1ed patch 9.0.0008: cannot specify the variable name for "xxd -i"
Bram Moolenaar <Bram@vim.org>
parents: 27118
diff changeset
245 $d
948c947cb1ed patch 9.0.0008: cannot specify the variable name for "xxd -i"
Bram Moolenaar <Bram@vim.org>
parents: 27118
diff changeset
246 let expected =<< trim [CODE]
948c947cb1ed patch 9.0.0008: cannot specify the variable name for "xxd -i"
Bram Moolenaar <Bram@vim.org>
parents: 27118
diff changeset
247 unsigned char StdIn[] = {
948c947cb1ed patch 9.0.0008: cannot specify the variable name for "xxd -i"
Bram Moolenaar <Bram@vim.org>
parents: 27118
diff changeset
248 0x54, 0x45, 0x53, 0x54, 0x61, 0x62, 0x63, 0x64, 0x30, 0x39, 0x0a
948c947cb1ed patch 9.0.0008: cannot specify the variable name for "xxd -i"
Bram Moolenaar <Bram@vim.org>
parents: 27118
diff changeset
249 };
34207
5aee5855ccfe patch 9.1.0052: Patch 9.1.0041 causes regressions for users
Christian Brabandt <cb@256bit.org>
parents: 34165
diff changeset
250 unsigned int StdIn_len = 11;
29330
948c947cb1ed patch 9.0.0008: cannot specify the variable name for "xxd -i"
Bram Moolenaar <Bram@vim.org>
parents: 27118
diff changeset
251 [CODE]
948c947cb1ed patch 9.0.0008: cannot specify the variable name for "xxd -i"
Bram Moolenaar <Bram@vim.org>
parents: 27118
diff changeset
252 call assert_equal(expected, getline(1,'$'), s:Mess(s:test))
948c947cb1ed patch 9.0.0008: cannot specify the variable name for "xxd -i"
Bram Moolenaar <Bram@vim.org>
parents: 27118
diff changeset
253
948c947cb1ed patch 9.0.0008: cannot specify the variable name for "xxd -i"
Bram Moolenaar <Bram@vim.org>
parents: 27118
diff changeset
254
948c947cb1ed patch 9.0.0008: cannot specify the variable name for "xxd -i"
Bram Moolenaar <Bram@vim.org>
parents: 27118
diff changeset
255 " Test 18: Print C include: custom variable names can be capitalized
948c947cb1ed patch 9.0.0008: cannot specify the variable name for "xxd -i"
Bram Moolenaar <Bram@vim.org>
parents: 27118
diff changeset
256 let s:test += 1
948c947cb1ed patch 9.0.0008: cannot specify the variable name for "xxd -i"
Bram Moolenaar <Bram@vim.org>
parents: 27118
diff changeset
257 for arg in ['-C', '-capitalize']
948c947cb1ed patch 9.0.0008: cannot specify the variable name for "xxd -i"
Bram Moolenaar <Bram@vim.org>
parents: 27118
diff changeset
258 call writefile(['TESTabcd09'], 'XXDfile')
948c947cb1ed patch 9.0.0008: cannot specify the variable name for "xxd -i"
Bram Moolenaar <Bram@vim.org>
parents: 27118
diff changeset
259 %d
948c947cb1ed patch 9.0.0008: cannot specify the variable name for "xxd -i"
Bram Moolenaar <Bram@vim.org>
parents: 27118
diff changeset
260 exe '0r! ' . s:xxd_cmd . ' -i ' . arg . ' -n varName XXDfile'
948c947cb1ed patch 9.0.0008: cannot specify the variable name for "xxd -i"
Bram Moolenaar <Bram@vim.org>
parents: 27118
diff changeset
261 $d
948c947cb1ed patch 9.0.0008: cannot specify the variable name for "xxd -i"
Bram Moolenaar <Bram@vim.org>
parents: 27118
diff changeset
262 let expected =<< trim [CODE]
948c947cb1ed patch 9.0.0008: cannot specify the variable name for "xxd -i"
Bram Moolenaar <Bram@vim.org>
parents: 27118
diff changeset
263 unsigned char VARNAME[] = {
948c947cb1ed patch 9.0.0008: cannot specify the variable name for "xxd -i"
Bram Moolenaar <Bram@vim.org>
parents: 27118
diff changeset
264 0x54, 0x45, 0x53, 0x54, 0x61, 0x62, 0x63, 0x64, 0x30, 0x39, 0x0a
948c947cb1ed patch 9.0.0008: cannot specify the variable name for "xxd -i"
Bram Moolenaar <Bram@vim.org>
parents: 27118
diff changeset
265 };
34207
5aee5855ccfe patch 9.1.0052: Patch 9.1.0041 causes regressions for users
Christian Brabandt <cb@256bit.org>
parents: 34165
diff changeset
266 unsigned int VARNAME_LEN = 11;
29330
948c947cb1ed patch 9.0.0008: cannot specify the variable name for "xxd -i"
Bram Moolenaar <Bram@vim.org>
parents: 27118
diff changeset
267 [CODE]
948c947cb1ed patch 9.0.0008: cannot specify the variable name for "xxd -i"
Bram Moolenaar <Bram@vim.org>
parents: 27118
diff changeset
268 call assert_equal(expected, getline(1,'$'), s:Mess(s:test))
948c947cb1ed patch 9.0.0008: cannot specify the variable name for "xxd -i"
Bram Moolenaar <Bram@vim.org>
parents: 27118
diff changeset
269 endfor
948c947cb1ed patch 9.0.0008: cannot specify the variable name for "xxd -i"
Bram Moolenaar <Bram@vim.org>
parents: 27118
diff changeset
270
948c947cb1ed patch 9.0.0008: cannot specify the variable name for "xxd -i"
Bram Moolenaar <Bram@vim.org>
parents: 27118
diff changeset
271
13634
2678e38e1de6 patch 8.0.1689: no tests for xxd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
272 %d
20784
d7d6993fc266 patch 8.2.0944: xxd test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents: 20601
diff changeset
273 bwipe!
d7d6993fc266 patch 8.2.0944: xxd test leaves file behind
Bram Moolenaar <Bram@vim.org>
parents: 20601
diff changeset
274 call delete('XXDfile')
13634
2678e38e1de6 patch 8.0.1689: no tests for xxd
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
275 endfunc
15627
11879b89bb69 patch 8.1.0821: xxd "usage" output and other arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
276
26036
c8165ec9dcad patch 8.2.3552: xxd revert does not handle end of line correctly
Bram Moolenaar <Bram@vim.org>
parents: 25076
diff changeset
277 func Test_xxd_patch()
26038
542cc55a660b patch 8.2.3553: xxd test fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents: 26036
diff changeset
278 let cmd1 = 'silent !' .. s:xxd_cmd .. ' -r Xxxdin Xxxdfile'
542cc55a660b patch 8.2.3553: xxd test fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents: 26036
diff changeset
279 let cmd2 = 'silent !' .. s:xxd_cmd .. ' -g1 Xxxdfile > Xxxdout'
30869
bff3fa5f4c74 patch 9.0.0769: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 29330
diff changeset
280 call writefile(["2: 41 41", "8: 42 42"], 'Xxxdin', 'D')
bff3fa5f4c74 patch 9.0.0769: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 29330
diff changeset
281 call writefile(['::::::::'], 'Xxxdfile', 'D')
26038
542cc55a660b patch 8.2.3553: xxd test fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents: 26036
diff changeset
282 exe cmd1
542cc55a660b patch 8.2.3553: xxd test fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents: 26036
diff changeset
283 exe cmd2
26036
c8165ec9dcad patch 8.2.3552: xxd revert does not handle end of line correctly
Bram Moolenaar <Bram@vim.org>
parents: 25076
diff changeset
284 call assert_equal(['00000000: 3a 3a 41 41 3a 3a 3a 3a 42 42 ::AA::::BB'], readfile('Xxxdout'))
c8165ec9dcad patch 8.2.3552: xxd revert does not handle end of line correctly
Bram Moolenaar <Bram@vim.org>
parents: 25076
diff changeset
285
c8165ec9dcad patch 8.2.3552: xxd revert does not handle end of line correctly
Bram Moolenaar <Bram@vim.org>
parents: 25076
diff changeset
286 call writefile(["2: 43 43 ", "8: 44 44"], 'Xxxdin')
26038
542cc55a660b patch 8.2.3553: xxd test fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents: 26036
diff changeset
287 exe cmd1
542cc55a660b patch 8.2.3553: xxd test fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents: 26036
diff changeset
288 exe cmd2
26036
c8165ec9dcad patch 8.2.3552: xxd revert does not handle end of line correctly
Bram Moolenaar <Bram@vim.org>
parents: 25076
diff changeset
289 call assert_equal(['00000000: 3a 3a 43 43 3a 3a 3a 3a 44 44 ::CC::::DD'], readfile('Xxxdout'))
c8165ec9dcad patch 8.2.3552: xxd revert does not handle end of line correctly
Bram Moolenaar <Bram@vim.org>
parents: 25076
diff changeset
290
c8165ec9dcad patch 8.2.3552: xxd revert does not handle end of line correctly
Bram Moolenaar <Bram@vim.org>
parents: 25076
diff changeset
291 call writefile(["2: 45 45 ", "8: 46 46"], 'Xxxdin')
26038
542cc55a660b patch 8.2.3553: xxd test fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents: 26036
diff changeset
292 exe cmd1
542cc55a660b patch 8.2.3553: xxd test fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents: 26036
diff changeset
293 exe cmd2
26036
c8165ec9dcad patch 8.2.3552: xxd revert does not handle end of line correctly
Bram Moolenaar <Bram@vim.org>
parents: 25076
diff changeset
294 call assert_equal(['00000000: 3a 3a 45 45 3a 3a 3a 3a 46 46 ::EE::::FF'], readfile('Xxxdout'))
31849
dbec60b8c253 patch 9.0.1257: code style is not check in test scripts
Bram Moolenaar <Bram@vim.org>
parents: 30869
diff changeset
295
26036
c8165ec9dcad patch 8.2.3552: xxd revert does not handle end of line correctly
Bram Moolenaar <Bram@vim.org>
parents: 25076
diff changeset
296 call writefile(["2: 41 41", "08: 42 42"], 'Xxxdin')
c8165ec9dcad patch 8.2.3552: xxd revert does not handle end of line correctly
Bram Moolenaar <Bram@vim.org>
parents: 25076
diff changeset
297 call writefile(['::::::::'], 'Xxxdfile')
26038
542cc55a660b patch 8.2.3553: xxd test fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents: 26036
diff changeset
298 exe cmd1
542cc55a660b patch 8.2.3553: xxd test fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents: 26036
diff changeset
299 exe cmd2
26036
c8165ec9dcad patch 8.2.3552: xxd revert does not handle end of line correctly
Bram Moolenaar <Bram@vim.org>
parents: 25076
diff changeset
300 call assert_equal(['00000000: 3a 3a 41 41 3a 3a 3a 3a 42 42 ::AA::::BB'], readfile('Xxxdout'))
c8165ec9dcad patch 8.2.3552: xxd revert does not handle end of line correctly
Bram Moolenaar <Bram@vim.org>
parents: 25076
diff changeset
301
c8165ec9dcad patch 8.2.3552: xxd revert does not handle end of line correctly
Bram Moolenaar <Bram@vim.org>
parents: 25076
diff changeset
302 call writefile(["2: 43 43 ", "09: 44 44"], 'Xxxdin')
26038
542cc55a660b patch 8.2.3553: xxd test fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents: 26036
diff changeset
303 exe cmd1
542cc55a660b patch 8.2.3553: xxd test fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents: 26036
diff changeset
304 exe cmd2
26036
c8165ec9dcad patch 8.2.3552: xxd revert does not handle end of line correctly
Bram Moolenaar <Bram@vim.org>
parents: 25076
diff changeset
305 call assert_equal(['00000000: 3a 3a 43 43 3a 3a 3a 3a 42 44 44 ::CC::::BDD'], readfile('Xxxdout'))
c8165ec9dcad patch 8.2.3552: xxd revert does not handle end of line correctly
Bram Moolenaar <Bram@vim.org>
parents: 25076
diff changeset
306
c8165ec9dcad patch 8.2.3552: xxd revert does not handle end of line correctly
Bram Moolenaar <Bram@vim.org>
parents: 25076
diff changeset
307 call writefile(["2: 45 45 ", "0a: 46 46"], 'Xxxdin')
26038
542cc55a660b patch 8.2.3553: xxd test fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents: 26036
diff changeset
308 exe cmd1
542cc55a660b patch 8.2.3553: xxd test fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents: 26036
diff changeset
309 exe cmd2
26036
c8165ec9dcad patch 8.2.3552: xxd revert does not handle end of line correctly
Bram Moolenaar <Bram@vim.org>
parents: 25076
diff changeset
310 call assert_equal(['00000000: 3a 3a 45 45 3a 3a 3a 3a 42 44 46 46 ::EE::::BDFF'], readfile('Xxxdout'))
31849
dbec60b8c253 patch 9.0.1257: code style is not check in test scripts
Bram Moolenaar <Bram@vim.org>
parents: 30869
diff changeset
311
26036
c8165ec9dcad patch 8.2.3552: xxd revert does not handle end of line correctly
Bram Moolenaar <Bram@vim.org>
parents: 25076
diff changeset
312 call delete('Xxxdout')
c8165ec9dcad patch 8.2.3552: xxd revert does not handle end of line correctly
Bram Moolenaar <Bram@vim.org>
parents: 25076
diff changeset
313 endfunc
c8165ec9dcad patch 8.2.3552: xxd revert does not handle end of line correctly
Bram Moolenaar <Bram@vim.org>
parents: 25076
diff changeset
314
33496
33cbd544dc46 patch 9.0.1998: xxd: cannot reverse a bit dump
Christian Brabandt <cb@256bit.org>
parents: 33199
diff changeset
315 func Test_xxd_patch_with_bitdump()
33cbd544dc46 patch 9.0.1998: xxd: cannot reverse a bit dump
Christian Brabandt <cb@256bit.org>
parents: 33199
diff changeset
316 let cmd1 = 'silent !' .. s:xxd_cmd .. ' -r -b Xxxdin Xxxdfile'
33cbd544dc46 patch 9.0.1998: xxd: cannot reverse a bit dump
Christian Brabandt <cb@256bit.org>
parents: 33199
diff changeset
317 let cmd2 = 'silent !' .. s:xxd_cmd .. ' -g1 Xxxdfile > Xxxdout'
33cbd544dc46 patch 9.0.1998: xxd: cannot reverse a bit dump
Christian Brabandt <cb@256bit.org>
parents: 33199
diff changeset
318
33cbd544dc46 patch 9.0.1998: xxd: cannot reverse a bit dump
Christian Brabandt <cb@256bit.org>
parents: 33199
diff changeset
319 call writefile(["2: 01000001 01000001", "8: 01000010 01000010"], 'Xxxdin', 'D')
33cbd544dc46 patch 9.0.1998: xxd: cannot reverse a bit dump
Christian Brabandt <cb@256bit.org>
parents: 33199
diff changeset
320 call writefile(['::::::::'], 'Xxxdfile', 'D')
33cbd544dc46 patch 9.0.1998: xxd: cannot reverse a bit dump
Christian Brabandt <cb@256bit.org>
parents: 33199
diff changeset
321 exe cmd1
33cbd544dc46 patch 9.0.1998: xxd: cannot reverse a bit dump
Christian Brabandt <cb@256bit.org>
parents: 33199
diff changeset
322 exe cmd2
33cbd544dc46 patch 9.0.1998: xxd: cannot reverse a bit dump
Christian Brabandt <cb@256bit.org>
parents: 33199
diff changeset
323 call assert_equal(['00000000: 3a 3a 41 41 3a 3a 3a 3a 42 42 ::AA::::BB'], readfile('Xxxdout'))
33cbd544dc46 patch 9.0.1998: xxd: cannot reverse a bit dump
Christian Brabandt <cb@256bit.org>
parents: 33199
diff changeset
324
33cbd544dc46 patch 9.0.1998: xxd: cannot reverse a bit dump
Christian Brabandt <cb@256bit.org>
parents: 33199
diff changeset
325 call writefile(["1: 01000011 01000011", "4: 01000100 01000100"], 'Xxxdin', 'D')
33cbd544dc46 patch 9.0.1998: xxd: cannot reverse a bit dump
Christian Brabandt <cb@256bit.org>
parents: 33199
diff changeset
326 call writefile(['::::::::'], 'Xxxdfile', 'D')
33cbd544dc46 patch 9.0.1998: xxd: cannot reverse a bit dump
Christian Brabandt <cb@256bit.org>
parents: 33199
diff changeset
327 exe cmd1
33cbd544dc46 patch 9.0.1998: xxd: cannot reverse a bit dump
Christian Brabandt <cb@256bit.org>
parents: 33199
diff changeset
328 exe cmd2
33cbd544dc46 patch 9.0.1998: xxd: cannot reverse a bit dump
Christian Brabandt <cb@256bit.org>
parents: 33199
diff changeset
329 call assert_equal(['00000000: 3a 43 43 3a 44 44 3a 3a 0a :CC:DD::.'], readfile('Xxxdout'))
33cbd544dc46 patch 9.0.1998: xxd: cannot reverse a bit dump
Christian Brabandt <cb@256bit.org>
parents: 33199
diff changeset
330
33cbd544dc46 patch 9.0.1998: xxd: cannot reverse a bit dump
Christian Brabandt <cb@256bit.org>
parents: 33199
diff changeset
331 call writefile(["02: 01000101 01000101", "08: 01000110 01000110"], 'Xxxdin', 'D')
33cbd544dc46 patch 9.0.1998: xxd: cannot reverse a bit dump
Christian Brabandt <cb@256bit.org>
parents: 33199
diff changeset
332 call writefile(['::::::::'], 'Xxxdfile', 'D')
33cbd544dc46 patch 9.0.1998: xxd: cannot reverse a bit dump
Christian Brabandt <cb@256bit.org>
parents: 33199
diff changeset
333 exe cmd1
33cbd544dc46 patch 9.0.1998: xxd: cannot reverse a bit dump
Christian Brabandt <cb@256bit.org>
parents: 33199
diff changeset
334 exe cmd2
33cbd544dc46 patch 9.0.1998: xxd: cannot reverse a bit dump
Christian Brabandt <cb@256bit.org>
parents: 33199
diff changeset
335 call assert_equal(['00000000: 3a 3a 45 45 3a 3a 3a 3a 46 46 ::EE::::FF'], readfile('Xxxdout'))
33cbd544dc46 patch 9.0.1998: xxd: cannot reverse a bit dump
Christian Brabandt <cb@256bit.org>
parents: 33199
diff changeset
336
33cbd544dc46 patch 9.0.1998: xxd: cannot reverse a bit dump
Christian Brabandt <cb@256bit.org>
parents: 33199
diff changeset
337 call delete('Xxxdout')
33cbd544dc46 patch 9.0.1998: xxd: cannot reverse a bit dump
Christian Brabandt <cb@256bit.org>
parents: 33199
diff changeset
338 endfunc
33cbd544dc46 patch 9.0.1998: xxd: cannot reverse a bit dump
Christian Brabandt <cb@256bit.org>
parents: 33199
diff changeset
339
15627
11879b89bb69 patch 8.1.0821: xxd "usage" output and other arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
340 " Various ways with wrong arguments that trigger the usage output.
11879b89bb69 patch 8.1.0821: xxd "usage" output and other arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
341 func Test_xxd_usage()
33083
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
342 for arg in ['-h', '-c', '-g', '-o', '-s', '-l', '-X', '-R', 'one two three']
15627
11879b89bb69 patch 8.1.0821: xxd "usage" output and other arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
343 new
11879b89bb69 patch 8.1.0821: xxd "usage" output and other arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
344 exe 'r! ' . s:xxd_cmd . ' ' . arg
11879b89bb69 patch 8.1.0821: xxd "usage" output and other arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
345 call assert_match("Usage:", join(getline(1, 3)))
11879b89bb69 patch 8.1.0821: xxd "usage" output and other arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
346 bwipe!
11879b89bb69 patch 8.1.0821: xxd "usage" output and other arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
347 endfor
11879b89bb69 patch 8.1.0821: xxd "usage" output and other arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
348 endfunc
11879b89bb69 patch 8.1.0821: xxd "usage" output and other arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
349
26254
3a13efec0016 patch 8.2.3658: duplicate code in xxd
Bram Moolenaar <Bram@vim.org>
parents: 26038
diff changeset
350 func Test_xxd_ignore_garbage()
3a13efec0016 patch 8.2.3658: duplicate code in xxd
Bram Moolenaar <Bram@vim.org>
parents: 26038
diff changeset
351 new
3a13efec0016 patch 8.2.3658: duplicate code in xxd
Bram Moolenaar <Bram@vim.org>
parents: 26038
diff changeset
352 exe 'r! printf "\n\r xxxx 0: 42 42" | ' . s:xxd_cmd . ' -r'
3a13efec0016 patch 8.2.3658: duplicate code in xxd
Bram Moolenaar <Bram@vim.org>
parents: 26038
diff changeset
353 call assert_match('BB', join(getline(1, 3)))
3a13efec0016 patch 8.2.3658: duplicate code in xxd
Bram Moolenaar <Bram@vim.org>
parents: 26038
diff changeset
354 bwipe!
3a13efec0016 patch 8.2.3658: duplicate code in xxd
Bram Moolenaar <Bram@vim.org>
parents: 26038
diff changeset
355 endfunc
3a13efec0016 patch 8.2.3658: duplicate code in xxd
Bram Moolenaar <Bram@vim.org>
parents: 26038
diff changeset
356
3a13efec0016 patch 8.2.3658: duplicate code in xxd
Bram Moolenaar <Bram@vim.org>
parents: 26038
diff changeset
357 func Test_xxd_bit_dump()
3a13efec0016 patch 8.2.3658: duplicate code in xxd
Bram Moolenaar <Bram@vim.org>
parents: 26038
diff changeset
358 new
3a13efec0016 patch 8.2.3658: duplicate code in xxd
Bram Moolenaar <Bram@vim.org>
parents: 26038
diff changeset
359 exe 'r! printf "123456" | ' . s:xxd_cmd . ' -b1'
3a13efec0016 patch 8.2.3658: duplicate code in xxd
Bram Moolenaar <Bram@vim.org>
parents: 26038
diff changeset
360 call assert_match('00000000: 00110001 00110010 00110011 00110100 00110101 00110110 123456', join(getline(1, 3)))
3a13efec0016 patch 8.2.3658: duplicate code in xxd
Bram Moolenaar <Bram@vim.org>
parents: 26038
diff changeset
361 bwipe!
3a13efec0016 patch 8.2.3658: duplicate code in xxd
Bram Moolenaar <Bram@vim.org>
parents: 26038
diff changeset
362 endfunc
3a13efec0016 patch 8.2.3658: duplicate code in xxd
Bram Moolenaar <Bram@vim.org>
parents: 26038
diff changeset
363
33496
33cbd544dc46 patch 9.0.1998: xxd: cannot reverse a bit dump
Christian Brabandt <cb@256bit.org>
parents: 33199
diff changeset
364 func Test_xxd_revert_bit_dump()
33cbd544dc46 patch 9.0.1998: xxd: cannot reverse a bit dump
Christian Brabandt <cb@256bit.org>
parents: 33199
diff changeset
365 new
33cbd544dc46 patch 9.0.1998: xxd: cannot reverse a bit dump
Christian Brabandt <cb@256bit.org>
parents: 33199
diff changeset
366 exe 'r! printf "00000000: 01000001 01100010 01000011 01100100 01000101 01100110 01000111 01101000 AbCdEfGh" | ' . s:xxd_cmd . ' -r -b1 -c 8'
33cbd544dc46 patch 9.0.1998: xxd: cannot reverse a bit dump
Christian Brabandt <cb@256bit.org>
parents: 33199
diff changeset
367 call assert_match('AbCdEfGh', join(getline(1, 3)))
33cbd544dc46 patch 9.0.1998: xxd: cannot reverse a bit dump
Christian Brabandt <cb@256bit.org>
parents: 33199
diff changeset
368 bwipe!
33cbd544dc46 patch 9.0.1998: xxd: cannot reverse a bit dump
Christian Brabandt <cb@256bit.org>
parents: 33199
diff changeset
369
33cbd544dc46 patch 9.0.1998: xxd: cannot reverse a bit dump
Christian Brabandt <cb@256bit.org>
parents: 33199
diff changeset
370 new
33cbd544dc46 patch 9.0.1998: xxd: cannot reverse a bit dump
Christian Brabandt <cb@256bit.org>
parents: 33199
diff changeset
371 exe 'r! printf "00000000: 01000001 01100010 01000011 01100100 01000101 01100110 AbCdEf\n00000006: 01000111 01101000 Gh\n" | ' . s:xxd_cmd . ' -r -b1'
33cbd544dc46 patch 9.0.1998: xxd: cannot reverse a bit dump
Christian Brabandt <cb@256bit.org>
parents: 33199
diff changeset
372 call assert_match('AbCdEfGh', join(getline(1, 3)))
33cbd544dc46 patch 9.0.1998: xxd: cannot reverse a bit dump
Christian Brabandt <cb@256bit.org>
parents: 33199
diff changeset
373 bwipe!
33cbd544dc46 patch 9.0.1998: xxd: cannot reverse a bit dump
Christian Brabandt <cb@256bit.org>
parents: 33199
diff changeset
374 endfunc
33cbd544dc46 patch 9.0.1998: xxd: cannot reverse a bit dump
Christian Brabandt <cb@256bit.org>
parents: 33199
diff changeset
375
33654
a3616b5f5b25 patch 9.0.2066: xxd: corrupting files when reversing bit dumps
Christian Brabandt <cb@256bit.org>
parents: 33496
diff changeset
376 func Test_xxd_roundtrip_large_bit_dump()
a3616b5f5b25 patch 9.0.2066: xxd: corrupting files when reversing bit dumps
Christian Brabandt <cb@256bit.org>
parents: 33496
diff changeset
377 new
a3616b5f5b25 patch 9.0.2066: xxd: corrupting files when reversing bit dumps
Christian Brabandt <cb@256bit.org>
parents: 33496
diff changeset
378 exe 'r! printf "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" | ' . s:xxd_cmd . ' -b | ' . s:xxd_cmd . ' -r -b'
a3616b5f5b25 patch 9.0.2066: xxd: corrupting files when reversing bit dumps
Christian Brabandt <cb@256bit.org>
parents: 33496
diff changeset
379 call assert_match('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ012345678', join(getline(1, 3)))
a3616b5f5b25 patch 9.0.2066: xxd: corrupting files when reversing bit dumps
Christian Brabandt <cb@256bit.org>
parents: 33496
diff changeset
380 bwipe!
a3616b5f5b25 patch 9.0.2066: xxd: corrupting files when reversing bit dumps
Christian Brabandt <cb@256bit.org>
parents: 33496
diff changeset
381 endfunc
a3616b5f5b25 patch 9.0.2066: xxd: corrupting files when reversing bit dumps
Christian Brabandt <cb@256bit.org>
parents: 33496
diff changeset
382
15627
11879b89bb69 patch 8.1.0821: xxd "usage" output and other arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
383 func Test_xxd_version()
11879b89bb69 patch 8.1.0821: xxd "usage" output and other arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
384 new
11879b89bb69 patch 8.1.0821: xxd "usage" output and other arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
385 exe 'r! ' . s:xxd_cmd . ' -v'
25076
5690cf66ee07 patch 8.2.3075: xxd always reports an old version string
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
386 call assert_match('xxd 20\d\d-\d\d-\d\d by Juergen Weigert et al\.', join(getline(1, 3)))
15627
11879b89bb69 patch 8.1.0821: xxd "usage" output and other arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
387 bwipe!
11879b89bb69 patch 8.1.0821: xxd "usage" output and other arguments not tested
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
388 endfunc
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 20784
diff changeset
389
27102
4061623aa316 patch 8.2.4080: not sufficient test coverage for xxd
Bram Moolenaar <Bram@vim.org>
parents: 26254
diff changeset
390 " number of columns must be non-negative
4061623aa316 patch 8.2.4080: not sufficient test coverage for xxd
Bram Moolenaar <Bram@vim.org>
parents: 26254
diff changeset
391 func Test_xxd_min_cols()
4061623aa316 patch 8.2.4080: not sufficient test coverage for xxd
Bram Moolenaar <Bram@vim.org>
parents: 26254
diff changeset
392 for cols in ['-c-1', '-c -1', '-cols -1']
4061623aa316 patch 8.2.4080: not sufficient test coverage for xxd
Bram Moolenaar <Bram@vim.org>
parents: 26254
diff changeset
393 for fmt in ['', '-b', '-e', '-i', '-p', ]
4061623aa316 patch 8.2.4080: not sufficient test coverage for xxd
Bram Moolenaar <Bram@vim.org>
parents: 26254
diff changeset
394 new
4061623aa316 patch 8.2.4080: not sufficient test coverage for xxd
Bram Moolenaar <Bram@vim.org>
parents: 26254
diff changeset
395 exe 'r! printf "ignored" | ' . s:xxd_cmd . ' ' . cols . ' ' . fmt
4061623aa316 patch 8.2.4080: not sufficient test coverage for xxd
Bram Moolenaar <Bram@vim.org>
parents: 26254
diff changeset
396 call assert_match("invalid number of columns", join(getline(1, '$')))
4061623aa316 patch 8.2.4080: not sufficient test coverage for xxd
Bram Moolenaar <Bram@vim.org>
parents: 26254
diff changeset
397 bwipe!
4061623aa316 patch 8.2.4080: not sufficient test coverage for xxd
Bram Moolenaar <Bram@vim.org>
parents: 26254
diff changeset
398 endfor
4061623aa316 patch 8.2.4080: not sufficient test coverage for xxd
Bram Moolenaar <Bram@vim.org>
parents: 26254
diff changeset
399 endfor
4061623aa316 patch 8.2.4080: not sufficient test coverage for xxd
Bram Moolenaar <Bram@vim.org>
parents: 26254
diff changeset
400 endfunc
4061623aa316 patch 8.2.4080: not sufficient test coverage for xxd
Bram Moolenaar <Bram@vim.org>
parents: 26254
diff changeset
401
4061623aa316 patch 8.2.4080: not sufficient test coverage for xxd
Bram Moolenaar <Bram@vim.org>
parents: 26254
diff changeset
402 " some hex formats limit columns to 256 (a #define in xxd.c)
4061623aa316 patch 8.2.4080: not sufficient test coverage for xxd
Bram Moolenaar <Bram@vim.org>
parents: 26254
diff changeset
403 func Test_xxd_max_cols()
4061623aa316 patch 8.2.4080: not sufficient test coverage for xxd
Bram Moolenaar <Bram@vim.org>
parents: 26254
diff changeset
404 for cols in ['-c257', '-c 257', '-cols 257']
4061623aa316 patch 8.2.4080: not sufficient test coverage for xxd
Bram Moolenaar <Bram@vim.org>
parents: 26254
diff changeset
405 for fmt in ['', '-b', '-e' ]
4061623aa316 patch 8.2.4080: not sufficient test coverage for xxd
Bram Moolenaar <Bram@vim.org>
parents: 26254
diff changeset
406 new
4061623aa316 patch 8.2.4080: not sufficient test coverage for xxd
Bram Moolenaar <Bram@vim.org>
parents: 26254
diff changeset
407 exe 'r! printf "ignored" | ' . s:xxd_cmd . ' ' . cols . ' ' . fmt
4061623aa316 patch 8.2.4080: not sufficient test coverage for xxd
Bram Moolenaar <Bram@vim.org>
parents: 26254
diff changeset
408 call assert_match("invalid number of columns", join(getline(1, '$')))
4061623aa316 patch 8.2.4080: not sufficient test coverage for xxd
Bram Moolenaar <Bram@vim.org>
parents: 26254
diff changeset
409 bwipe!
4061623aa316 patch 8.2.4080: not sufficient test coverage for xxd
Bram Moolenaar <Bram@vim.org>
parents: 26254
diff changeset
410 endfor
4061623aa316 patch 8.2.4080: not sufficient test coverage for xxd
Bram Moolenaar <Bram@vim.org>
parents: 26254
diff changeset
411 endfor
4061623aa316 patch 8.2.4080: not sufficient test coverage for xxd
Bram Moolenaar <Bram@vim.org>
parents: 26254
diff changeset
412 endfunc
4061623aa316 patch 8.2.4080: not sufficient test coverage for xxd
Bram Moolenaar <Bram@vim.org>
parents: 26254
diff changeset
413
35150
42f061099b39 patch 9.1.0404: [security] xxd: buffer-overflow with specific flags
Christian Brabandt <cb@256bit.org>
parents: 34207
diff changeset
414
35153
b2ea090aea59 patch 9.1.0405: tests: xxd buffer overflow fails on 32-bit
Christian Brabandt <cb@256bit.org>
parents: 35150
diff changeset
415 " This used to trigger a buffer overflow (#14738)
35150
42f061099b39 patch 9.1.0404: [security] xxd: buffer-overflow with specific flags
Christian Brabandt <cb@256bit.org>
parents: 34207
diff changeset
416 func Test_xxd_buffer_overflow()
42f061099b39 patch 9.1.0404: [security] xxd: buffer-overflow with specific flags
Christian Brabandt <cb@256bit.org>
parents: 34207
diff changeset
417 CheckUnix
35153
b2ea090aea59 patch 9.1.0405: tests: xxd buffer overflow fails on 32-bit
Christian Brabandt <cb@256bit.org>
parents: 35150
diff changeset
418 if system('file ' .. s:xxd_cmd) =~ '32-bit'
b2ea090aea59 patch 9.1.0405: tests: xxd buffer overflow fails on 32-bit
Christian Brabandt <cb@256bit.org>
parents: 35150
diff changeset
419 throw 'Skipped: test only works on 64-bit architecture'
b2ea090aea59 patch 9.1.0405: tests: xxd buffer overflow fails on 32-bit
Christian Brabandt <cb@256bit.org>
parents: 35150
diff changeset
420 endif
35150
42f061099b39 patch 9.1.0404: [security] xxd: buffer-overflow with specific flags
Christian Brabandt <cb@256bit.org>
parents: 34207
diff changeset
421 new
42f061099b39 patch 9.1.0404: [security] xxd: buffer-overflow with specific flags
Christian Brabandt <cb@256bit.org>
parents: 34207
diff changeset
422 let input = repeat('A', 256)
42f061099b39 patch 9.1.0404: [security] xxd: buffer-overflow with specific flags
Christian Brabandt <cb@256bit.org>
parents: 34207
diff changeset
423 call writefile(['-9223372036854775808: ' . repeat("\e[1;32m41\e[0m ", 256) . ' ' . repeat("\e[1;32mA\e[0m", 256)], 'Xxdexpected', 'D')
42f061099b39 patch 9.1.0404: [security] xxd: buffer-overflow with specific flags
Christian Brabandt <cb@256bit.org>
parents: 34207
diff changeset
424 exe 'r! printf ' . input . '| ' . s:xxd_cmd . ' -Ralways -g1 -c256 -d -o 9223372036854775808 > Xxdout'
42f061099b39 patch 9.1.0404: [security] xxd: buffer-overflow with specific flags
Christian Brabandt <cb@256bit.org>
parents: 34207
diff changeset
425 call assert_equalfile('Xxdexpected', 'Xxdout')
42f061099b39 patch 9.1.0404: [security] xxd: buffer-overflow with specific flags
Christian Brabandt <cb@256bit.org>
parents: 34207
diff changeset
426 call delete('Xxdout')
42f061099b39 patch 9.1.0404: [security] xxd: buffer-overflow with specific flags
Christian Brabandt <cb@256bit.org>
parents: 34207
diff changeset
427 bwipe!
42f061099b39 patch 9.1.0404: [security] xxd: buffer-overflow with specific flags
Christian Brabandt <cb@256bit.org>
parents: 34207
diff changeset
428 endfunc
42f061099b39 patch 9.1.0404: [security] xxd: buffer-overflow with specific flags
Christian Brabandt <cb@256bit.org>
parents: 34207
diff changeset
429
27102
4061623aa316 patch 8.2.4080: not sufficient test coverage for xxd
Bram Moolenaar <Bram@vim.org>
parents: 26254
diff changeset
430 " -c0 selects the format specific default column value, as if no -c was given
27118
2f854597399f patch 8.2.4088: xxd cannot output everything in one line
Bram Moolenaar <Bram@vim.org>
parents: 27102
diff changeset
431 " except for -ps, where it disables extra newlines
27102
4061623aa316 patch 8.2.4080: not sufficient test coverage for xxd
Bram Moolenaar <Bram@vim.org>
parents: 26254
diff changeset
432 func Test_xxd_c0_is_def_cols()
30869
bff3fa5f4c74 patch 9.0.0769: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 29330
diff changeset
433 call writefile(["abcdefghijklmnopqrstuvwxyz0123456789"], 'Xxdin', 'D')
27102
4061623aa316 patch 8.2.4080: not sufficient test coverage for xxd
Bram Moolenaar <Bram@vim.org>
parents: 26254
diff changeset
434 for cols in ['-c0', '-c 0', '-cols 0']
27118
2f854597399f patch 8.2.4088: xxd cannot output everything in one line
Bram Moolenaar <Bram@vim.org>
parents: 27102
diff changeset
435 for fmt in ['', '-b', '-e', '-i']
27102
4061623aa316 patch 8.2.4080: not sufficient test coverage for xxd
Bram Moolenaar <Bram@vim.org>
parents: 26254
diff changeset
436 exe 'r! ' . s:xxd_cmd . ' ' . fmt ' Xxdin > Xxdout1'
4061623aa316 patch 8.2.4080: not sufficient test coverage for xxd
Bram Moolenaar <Bram@vim.org>
parents: 26254
diff changeset
437 exe 'r! ' . s:xxd_cmd . ' ' . cols . ' ' . fmt ' Xxdin > Xxdout2'
4061623aa316 patch 8.2.4080: not sufficient test coverage for xxd
Bram Moolenaar <Bram@vim.org>
parents: 26254
diff changeset
438 call assert_equalfile('Xxdout1', 'Xxdout2')
4061623aa316 patch 8.2.4080: not sufficient test coverage for xxd
Bram Moolenaar <Bram@vim.org>
parents: 26254
diff changeset
439 endfor
4061623aa316 patch 8.2.4080: not sufficient test coverage for xxd
Bram Moolenaar <Bram@vim.org>
parents: 26254
diff changeset
440 endfor
4061623aa316 patch 8.2.4080: not sufficient test coverage for xxd
Bram Moolenaar <Bram@vim.org>
parents: 26254
diff changeset
441 call delete('Xxdout1')
4061623aa316 patch 8.2.4080: not sufficient test coverage for xxd
Bram Moolenaar <Bram@vim.org>
parents: 26254
diff changeset
442 call delete('Xxdout2')
4061623aa316 patch 8.2.4080: not sufficient test coverage for xxd
Bram Moolenaar <Bram@vim.org>
parents: 26254
diff changeset
443 endfunc
4061623aa316 patch 8.2.4080: not sufficient test coverage for xxd
Bram Moolenaar <Bram@vim.org>
parents: 26254
diff changeset
444
27118
2f854597399f patch 8.2.4088: xxd cannot output everything in one line
Bram Moolenaar <Bram@vim.org>
parents: 27102
diff changeset
445 " all output in a single line for -c0 -ps
2f854597399f patch 8.2.4088: xxd cannot output everything in one line
Bram Moolenaar <Bram@vim.org>
parents: 27102
diff changeset
446 func Test_xxd_plain_one_line()
2f854597399f patch 8.2.4088: xxd cannot output everything in one line
Bram Moolenaar <Bram@vim.org>
parents: 27102
diff changeset
447 call writefile([
2f854597399f patch 8.2.4088: xxd cannot output everything in one line
Bram Moolenaar <Bram@vim.org>
parents: 27102
diff changeset
448 \ "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",
2f854597399f patch 8.2.4088: xxd cannot output everything in one line
Bram Moolenaar <Bram@vim.org>
parents: 27102
diff changeset
449 \ "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",
2f854597399f patch 8.2.4088: xxd cannot output everything in one line
Bram Moolenaar <Bram@vim.org>
parents: 27102
diff changeset
450 \ "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",
2f854597399f patch 8.2.4088: xxd cannot output everything in one line
Bram Moolenaar <Bram@vim.org>
parents: 27102
diff changeset
451 \ "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",
2f854597399f patch 8.2.4088: xxd cannot output everything in one line
Bram Moolenaar <Bram@vim.org>
parents: 27102
diff changeset
452 \ "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",
2f854597399f patch 8.2.4088: xxd cannot output everything in one line
Bram Moolenaar <Bram@vim.org>
parents: 27102
diff changeset
453 \ "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"],
30869
bff3fa5f4c74 patch 9.0.0769: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 29330
diff changeset
454 \ 'Xxdin', 'D')
27118
2f854597399f patch 8.2.4088: xxd cannot output everything in one line
Bram Moolenaar <Bram@vim.org>
parents: 27102
diff changeset
455 for cols in ['-c0', '-c 0', '-cols 0']
2f854597399f patch 8.2.4088: xxd cannot output everything in one line
Bram Moolenaar <Bram@vim.org>
parents: 27102
diff changeset
456 exe 'r! ' . s:xxd_cmd . ' -ps ' . cols ' Xxdin'
2f854597399f patch 8.2.4088: xxd cannot output everything in one line
Bram Moolenaar <Bram@vim.org>
parents: 27102
diff changeset
457 " output seems to start in line 2
2f854597399f patch 8.2.4088: xxd cannot output everything in one line
Bram Moolenaar <Bram@vim.org>
parents: 27102
diff changeset
458 let out = join(getline(2, '$'))
2f854597399f patch 8.2.4088: xxd cannot output everything in one line
Bram Moolenaar <Bram@vim.org>
parents: 27102
diff changeset
459 bwipe!
2f854597399f patch 8.2.4088: xxd cannot output everything in one line
Bram Moolenaar <Bram@vim.org>
parents: 27102
diff changeset
460 " newlines in xxd output result in spaces in the string variable out
2f854597399f patch 8.2.4088: xxd cannot output everything in one line
Bram Moolenaar <Bram@vim.org>
parents: 27102
diff changeset
461 call assert_notmatch(" ", out)
2f854597399f patch 8.2.4088: xxd cannot output everything in one line
Bram Moolenaar <Bram@vim.org>
parents: 27102
diff changeset
462 " xxd output must be non-empty and comprise only lower case hex digits
2f854597399f patch 8.2.4088: xxd cannot output everything in one line
Bram Moolenaar <Bram@vim.org>
parents: 27102
diff changeset
463 call assert_match("^[0-9a-f][0-9a-f]*$", out)
2f854597399f patch 8.2.4088: xxd cannot output everything in one line
Bram Moolenaar <Bram@vim.org>
parents: 27102
diff changeset
464 endfor
2f854597399f patch 8.2.4088: xxd cannot output everything in one line
Bram Moolenaar <Bram@vim.org>
parents: 27102
diff changeset
465 endfunc
2f854597399f patch 8.2.4088: xxd cannot output everything in one line
Bram Moolenaar <Bram@vim.org>
parents: 27102
diff changeset
466
32104
5a1113ece237 patch 9.0.1383: xxd: combination of little endian and cols fails
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
467 func Test_xxd_little_endian_with_cols()
5a1113ece237 patch 9.0.1383: xxd: combination of little endian and cols fails
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
468 enew!
5a1113ece237 patch 9.0.1383: xxd: combination of little endian and cols fails
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
469 call writefile(["ABCDEF"], 'Xxdin', 'D')
5a1113ece237 patch 9.0.1383: xxd: combination of little endian and cols fails
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
470 exe 'r! ' .. s:xxd_cmd .. ' -e -c6 ' .. ' Xxdin'
5a1113ece237 patch 9.0.1383: xxd: combination of little endian and cols fails
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
471 call assert_equal('00000000: 44434241 4645 ABCDEF', getline(2))
5a1113ece237 patch 9.0.1383: xxd: combination of little endian and cols fails
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
472
5a1113ece237 patch 9.0.1383: xxd: combination of little endian and cols fails
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
473 enew!
5a1113ece237 patch 9.0.1383: xxd: combination of little endian and cols fails
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
474 call writefile(["ABCDEFGHI"], 'Xxdin', 'D')
5a1113ece237 patch 9.0.1383: xxd: combination of little endian and cols fails
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
475 exe 'r! ' .. s:xxd_cmd .. ' -e -c9 ' .. ' Xxdin'
5a1113ece237 patch 9.0.1383: xxd: combination of little endian and cols fails
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
476 call assert_equal('00000000: 44434241 48474645 49 ABCDEFGHI', getline(2))
5a1113ece237 patch 9.0.1383: xxd: combination of little endian and cols fails
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
477
5a1113ece237 patch 9.0.1383: xxd: combination of little endian and cols fails
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
478 bwipe!
5a1113ece237 patch 9.0.1383: xxd: combination of little endian and cols fails
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
479 endfunc
5a1113ece237 patch 9.0.1383: xxd: combination of little endian and cols fails
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
480
33083
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
481 func Test_xxd_color()
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
482 "Test: color=never
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
483 let s:test = 1
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
484
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
485 "Note Quotation mark escaped
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
486 "Note Aposhpere vaihdettu apostrophe replaced with 0x00
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
487 "Note Backslash replaced with 0x00
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
488 let data = [
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
489 \ "00000000: 0001 0203 0405 0607 0809 0a0b 0c0d 0e0f ................",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
490 \ "00000010: 1011 1213 1415 1617 1819 1a1b 1c1d 1e1f ................",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
491 \ "00000020: 2021 2223 2425 2600 2829 2a2b 2c2d 2e2f !\"#$%&.()*+,-./",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
492 \ "00000030: 3031 3233 3435 3637 3839 3a3b 3c3d 3e3f 0123456789:;<=>?",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
493 \ "00000040: 4041 4243 4445 4647 4849 4a4b 4c4d 4e4f @ABCDEFGHIJKLMNO",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
494 \ "00000050: 5051 5253 5455 5657 5859 5a5b 005d 5e5f PQRSTUVWXYZ[.]^_",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
495 \ "00000060: 6061 6263 6465 6667 6869 6a6b 6c6d 6e6f `abcdefghijklmno",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
496 \ "00000070: 7071 7273 7475 7677 7879 7a7b 7c7d 7e7f pqrstuvwxyz{|}~.",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
497 \ "00000080: 8081 8283 8485 8687 8889 8a8b 8c8d 8e8f ................",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
498 \ "00000090: 9091 9293 9495 9697 9899 9a9b 9c9d 9e9f ................",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
499 \ "000000a0: a0a1 a2a3 a4a5 a6a7 a8a9 aaab acad aeaf ................",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
500 \ "000000b0: b0b1 b2b3 b4b5 b6b7 b8b9 babb bcbd bebf ................",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
501 \ "000000c0: c0c1 c2c3 c4c5 c6c7 c8c9 cacb cccd cecf ................",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
502 \ "000000d0: d0d1 d2d3 d4d5 d6d7 d8d9 dadb dcdd dedf ................",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
503 \ "000000e0: e0e1 e2e3 e4e5 e6e7 e8e9 eaeb eced eeef ................",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
504 \ "000000f0: f0f1 f2f3 f4f5 f6f7 f8f9 fafb fcfd feff ................"]
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
505 call writefile(data,'Xinput')
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
506
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
507 silent exe '!' . s:xxd_cmd . ' -r < Xinput > XXDfile'
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
508
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
509 %d
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
510 exe '0r! ' . s:xxd_cmd . ' -R never ' . ' XXDfile'
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
511 $d
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
512 let expected = [
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
513 \ "00000000: 0001 0203 0405 0607 0809 0a0b 0c0d 0e0f ................",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
514 \ "00000010: 1011 1213 1415 1617 1819 1a1b 1c1d 1e1f ................",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
515 \ "00000020: 2021 2223 2425 2600 2829 2a2b 2c2d 2e2f !\"#$%&.()*+,-./",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
516 \ "00000030: 3031 3233 3435 3637 3839 3a3b 3c3d 3e3f 0123456789:;<=>?",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
517 \ "00000040: 4041 4243 4445 4647 4849 4a4b 4c4d 4e4f @ABCDEFGHIJKLMNO",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
518 \ "00000050: 5051 5253 5455 5657 5859 5a5b 005d 5e5f PQRSTUVWXYZ[.]^_",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
519 \ "00000060: 6061 6263 6465 6667 6869 6a6b 6c6d 6e6f `abcdefghijklmno",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
520 \ "00000070: 7071 7273 7475 7677 7879 7a7b 7c7d 7e7f pqrstuvwxyz{|}~.",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
521 \ "00000080: 8081 8283 8485 8687 8889 8a8b 8c8d 8e8f ................",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
522 \ "00000090: 9091 9293 9495 9697 9899 9a9b 9c9d 9e9f ................",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
523 \ "000000a0: a0a1 a2a3 a4a5 a6a7 a8a9 aaab acad aeaf ................",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
524 \ "000000b0: b0b1 b2b3 b4b5 b6b7 b8b9 babb bcbd bebf ................",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
525 \ "000000c0: c0c1 c2c3 c4c5 c6c7 c8c9 cacb cccd cecf ................",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
526 \ "000000d0: d0d1 d2d3 d4d5 d6d7 d8d9 dadb dcdd dedf ................",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
527 \ "000000e0: e0e1 e2e3 e4e5 e6e7 e8e9 eaeb eced eeef ................",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
528 \ "000000f0: f0f1 f2f3 f4f5 f6f7 f8f9 fafb fcfd feff ................"]
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
529
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
530 call assert_equal(expected, getline(1,'$'), s:Mess(s:test))
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
531
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
532 "Test: color=always
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
533 let s:test += 1
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
534
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
535 %d
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
536 exe '0r! ' . s:xxd_cmd . ' -R always -c 4 ' . ' XXDfile'
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
537 $d
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
538 let expected = [
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
539 \ "00000000: \e[1;37m00\e[0m\e[1;31m01\e[0m \e[1;31m02\e[0m\e[1;31m03\e[0m \e[1;37m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
540 \ "00000004: \e[1;31m04\e[0m\e[1;31m05\e[0m \e[1;31m06\e[0m\e[1;31m07\e[0m \e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
541 \ "00000008: \e[1;31m08\e[0m\e[1;33m09\e[0m \e[1;33m0a\e[0m\e[1;31m0b\e[0m \e[1;31m.\e[0m\e[1;33m.\e[0m\e[1;33m.\e[0m\e[1;31m.\e[0m",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
542 \ "0000000c: \e[1;31m0c\e[0m\e[1;33m0d\e[0m \e[1;31m0e\e[0m\e[1;31m0f\e[0m \e[1;31m.\e[0m\e[1;33m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
543 \ "00000010: \e[1;31m10\e[0m\e[1;31m11\e[0m \e[1;31m12\e[0m\e[1;31m13\e[0m \e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
544 \ "00000014: \e[1;31m14\e[0m\e[1;31m15\e[0m \e[1;31m16\e[0m\e[1;31m17\e[0m \e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
545 \ "00000018: \e[1;31m18\e[0m\e[1;31m19\e[0m \e[1;31m1a\e[0m\e[1;31m1b\e[0m \e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
546 \ "0000001c: \e[1;31m1c\e[0m\e[1;31m1d\e[0m \e[1;31m1e\e[0m\e[1;31m1f\e[0m \e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
547 \ "00000020: \e[1;32m20\e[0m\e[1;32m21\e[0m \e[1;32m22\e[0m\e[1;32m23\e[0m \e[1;32m \e[0m\e[1;32m!\e[0m\e[1;32m\"\e[0m\e[1;32m#\e[0m",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
548 \ "00000024: \e[1;32m24\e[0m\e[1;32m25\e[0m \e[1;32m26\e[0m\e[1;37m00\e[0m \e[1;32m$\e[0m\e[1;32m%\e[0m\e[1;32m&\e[0m\e[1;37m.\e[0m",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
549 \ "00000028: \e[1;32m28\e[0m\e[1;32m29\e[0m \e[1;32m2a\e[0m\e[1;32m2b\e[0m \e[1;32m(\e[0m\e[1;32m)\e[0m\e[1;32m*\e[0m\e[1;32m+\e[0m",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
550 \ "0000002c: \e[1;32m2c\e[0m\e[1;32m2d\e[0m \e[1;32m2e\e[0m\e[1;32m2f\e[0m \e[1;32m,\e[0m\e[1;32m-\e[0m\e[1;32m.\e[0m\e[1;32m/\e[0m",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
551 \ "00000030: \e[1;32m30\e[0m\e[1;32m31\e[0m \e[1;32m32\e[0m\e[1;32m33\e[0m \e[1;32m0\e[0m\e[1;32m1\e[0m\e[1;32m2\e[0m\e[1;32m3\e[0m",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
552 \ "00000034: \e[1;32m34\e[0m\e[1;32m35\e[0m \e[1;32m36\e[0m\e[1;32m37\e[0m \e[1;32m4\e[0m\e[1;32m5\e[0m\e[1;32m6\e[0m\e[1;32m7\e[0m",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
553 \ "00000038: \e[1;32m38\e[0m\e[1;32m39\e[0m \e[1;32m3a\e[0m\e[1;32m3b\e[0m \e[1;32m8\e[0m\e[1;32m9\e[0m\e[1;32m:\e[0m\e[1;32m;\e[0m",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
554 \ "0000003c: \e[1;32m3c\e[0m\e[1;32m3d\e[0m \e[1;32m3e\e[0m\e[1;32m3f\e[0m \e[1;32m<\e[0m\e[1;32m=\e[0m\e[1;32m>\e[0m\e[1;32m?\e[0m",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
555 \ "00000040: \e[1;32m40\e[0m\e[1;32m41\e[0m \e[1;32m42\e[0m\e[1;32m43\e[0m \e[1;32m@\e[0m\e[1;32mA\e[0m\e[1;32mB\e[0m\e[1;32mC\e[0m",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
556 \ "00000044: \e[1;32m44\e[0m\e[1;32m45\e[0m \e[1;32m46\e[0m\e[1;32m47\e[0m \e[1;32mD\e[0m\e[1;32mE\e[0m\e[1;32mF\e[0m\e[1;32mG\e[0m",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
557 \ "00000048: \e[1;32m48\e[0m\e[1;32m49\e[0m \e[1;32m4a\e[0m\e[1;32m4b\e[0m \e[1;32mH\e[0m\e[1;32mI\e[0m\e[1;32mJ\e[0m\e[1;32mK\e[0m",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
558 \ "0000004c: \e[1;32m4c\e[0m\e[1;32m4d\e[0m \e[1;32m4e\e[0m\e[1;32m4f\e[0m \e[1;32mL\e[0m\e[1;32mM\e[0m\e[1;32mN\e[0m\e[1;32mO\e[0m",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
559 \ "00000050: \e[1;32m50\e[0m\e[1;32m51\e[0m \e[1;32m52\e[0m\e[1;32m53\e[0m \e[1;32mP\e[0m\e[1;32mQ\e[0m\e[1;32mR\e[0m\e[1;32mS\e[0m",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
560 \ "00000054: \e[1;32m54\e[0m\e[1;32m55\e[0m \e[1;32m56\e[0m\e[1;32m57\e[0m \e[1;32mT\e[0m\e[1;32mU\e[0m\e[1;32mV\e[0m\e[1;32mW\e[0m",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
561 \ "00000058: \e[1;32m58\e[0m\e[1;32m59\e[0m \e[1;32m5a\e[0m\e[1;32m5b\e[0m \e[1;32mX\e[0m\e[1;32mY\e[0m\e[1;32mZ\e[0m\e[1;32m[\e[0m",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
562 \ "0000005c: \e[1;37m00\e[0m\e[1;32m5d\e[0m \e[1;32m5e\e[0m\e[1;32m5f\e[0m \e[1;37m.\e[0m\e[1;32m]\e[0m\e[1;32m^\e[0m\e[1;32m_\e[0m",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
563 \ "00000060: \e[1;32m60\e[0m\e[1;32m61\e[0m \e[1;32m62\e[0m\e[1;32m63\e[0m \e[1;32m`\e[0m\e[1;32ma\e[0m\e[1;32mb\e[0m\e[1;32mc\e[0m",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
564 \ "00000064: \e[1;32m64\e[0m\e[1;32m65\e[0m \e[1;32m66\e[0m\e[1;32m67\e[0m \e[1;32md\e[0m\e[1;32me\e[0m\e[1;32mf\e[0m\e[1;32mg\e[0m",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
565 \ "00000068: \e[1;32m68\e[0m\e[1;32m69\e[0m \e[1;32m6a\e[0m\e[1;32m6b\e[0m \e[1;32mh\e[0m\e[1;32mi\e[0m\e[1;32mj\e[0m\e[1;32mk\e[0m",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
566 \ "0000006c: \e[1;32m6c\e[0m\e[1;32m6d\e[0m \e[1;32m6e\e[0m\e[1;32m6f\e[0m \e[1;32ml\e[0m\e[1;32mm\e[0m\e[1;32mn\e[0m\e[1;32mo\e[0m",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
567 \ "00000070: \e[1;32m70\e[0m\e[1;32m71\e[0m \e[1;32m72\e[0m\e[1;32m73\e[0m \e[1;32mp\e[0m\e[1;32mq\e[0m\e[1;32mr\e[0m\e[1;32ms\e[0m",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
568 \ "00000074: \e[1;32m74\e[0m\e[1;32m75\e[0m \e[1;32m76\e[0m\e[1;32m77\e[0m \e[1;32mt\e[0m\e[1;32mu\e[0m\e[1;32mv\e[0m\e[1;32mw\e[0m",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
569 \ "00000078: \e[1;32m78\e[0m\e[1;32m79\e[0m \e[1;32m7a\e[0m\e[1;32m7b\e[0m \e[1;32mx\e[0m\e[1;32my\e[0m\e[1;32mz\e[0m\e[1;32m{\e[0m",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
570 \ "0000007c: \e[1;32m7c\e[0m\e[1;32m7d\e[0m \e[1;32m7e\e[0m\e[1;31m7f\e[0m \e[1;32m|\e[0m\e[1;32m}\e[0m\e[1;32m~\e[0m\e[1;31m.\e[0m",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
571 \ "00000080: \e[1;31m80\e[0m\e[1;31m81\e[0m \e[1;31m82\e[0m\e[1;31m83\e[0m \e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
572 \ "00000084: \e[1;31m84\e[0m\e[1;31m85\e[0m \e[1;31m86\e[0m\e[1;31m87\e[0m \e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
573 \ "00000088: \e[1;31m88\e[0m\e[1;31m89\e[0m \e[1;31m8a\e[0m\e[1;31m8b\e[0m \e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
574 \ "0000008c: \e[1;31m8c\e[0m\e[1;31m8d\e[0m \e[1;31m8e\e[0m\e[1;31m8f\e[0m \e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
575 \ "00000090: \e[1;31m90\e[0m\e[1;31m91\e[0m \e[1;31m92\e[0m\e[1;31m93\e[0m \e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
576 \ "00000094: \e[1;31m94\e[0m\e[1;31m95\e[0m \e[1;31m96\e[0m\e[1;31m97\e[0m \e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
577 \ "00000098: \e[1;31m98\e[0m\e[1;31m99\e[0m \e[1;31m9a\e[0m\e[1;31m9b\e[0m \e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
578 \ "0000009c: \e[1;31m9c\e[0m\e[1;31m9d\e[0m \e[1;31m9e\e[0m\e[1;31m9f\e[0m \e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
579 \ "000000a0: \e[1;31ma0\e[0m\e[1;31ma1\e[0m \e[1;31ma2\e[0m\e[1;31ma3\e[0m \e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
580 \ "000000a4: \e[1;31ma4\e[0m\e[1;31ma5\e[0m \e[1;31ma6\e[0m\e[1;31ma7\e[0m \e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
581 \ "000000a8: \e[1;31ma8\e[0m\e[1;31ma9\e[0m \e[1;31maa\e[0m\e[1;31mab\e[0m \e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
582 \ "000000ac: \e[1;31mac\e[0m\e[1;31mad\e[0m \e[1;31mae\e[0m\e[1;31maf\e[0m \e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
583 \ "000000b0: \e[1;31mb0\e[0m\e[1;31mb1\e[0m \e[1;31mb2\e[0m\e[1;31mb3\e[0m \e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
584 \ "000000b4: \e[1;31mb4\e[0m\e[1;31mb5\e[0m \e[1;31mb6\e[0m\e[1;31mb7\e[0m \e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
585 \ "000000b8: \e[1;31mb8\e[0m\e[1;31mb9\e[0m \e[1;31mba\e[0m\e[1;31mbb\e[0m \e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
586 \ "000000bc: \e[1;31mbc\e[0m\e[1;31mbd\e[0m \e[1;31mbe\e[0m\e[1;31mbf\e[0m \e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
587 \ "000000c0: \e[1;31mc0\e[0m\e[1;31mc1\e[0m \e[1;31mc2\e[0m\e[1;31mc3\e[0m \e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
588 \ "000000c4: \e[1;31mc4\e[0m\e[1;31mc5\e[0m \e[1;31mc6\e[0m\e[1;31mc7\e[0m \e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
589 \ "000000c8: \e[1;31mc8\e[0m\e[1;31mc9\e[0m \e[1;31mca\e[0m\e[1;31mcb\e[0m \e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
590 \ "000000cc: \e[1;31mcc\e[0m\e[1;31mcd\e[0m \e[1;31mce\e[0m\e[1;31mcf\e[0m \e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
591 \ "000000d0: \e[1;31md0\e[0m\e[1;31md1\e[0m \e[1;31md2\e[0m\e[1;31md3\e[0m \e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
592 \ "000000d4: \e[1;31md4\e[0m\e[1;31md5\e[0m \e[1;31md6\e[0m\e[1;31md7\e[0m \e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
593 \ "000000d8: \e[1;31md8\e[0m\e[1;31md9\e[0m \e[1;31mda\e[0m\e[1;31mdb\e[0m \e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
594 \ "000000dc: \e[1;31mdc\e[0m\e[1;31mdd\e[0m \e[1;31mde\e[0m\e[1;31mdf\e[0m \e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
595 \ "000000e0: \e[1;31me0\e[0m\e[1;31me1\e[0m \e[1;31me2\e[0m\e[1;31me3\e[0m \e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
596 \ "000000e4: \e[1;31me4\e[0m\e[1;31me5\e[0m \e[1;31me6\e[0m\e[1;31me7\e[0m \e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
597 \ "000000e8: \e[1;31me8\e[0m\e[1;31me9\e[0m \e[1;31mea\e[0m\e[1;31meb\e[0m \e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
598 \ "000000ec: \e[1;31mec\e[0m\e[1;31med\e[0m \e[1;31mee\e[0m\e[1;31mef\e[0m \e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
599 \ "000000f0: \e[1;31mf0\e[0m\e[1;31mf1\e[0m \e[1;31mf2\e[0m\e[1;31mf3\e[0m \e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
600 \ "000000f4: \e[1;31mf4\e[0m\e[1;31mf5\e[0m \e[1;31mf6\e[0m\e[1;31mf7\e[0m \e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
601 \ "000000f8: \e[1;31mf8\e[0m\e[1;31mf9\e[0m \e[1;31mfa\e[0m\e[1;31mfb\e[0m \e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
602 \ "000000fc: \e[1;31mfc\e[0m\e[1;31mfd\e[0m \e[1;31mfe\e[0m\e[1;34mff\e[0m \e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;31m.\e[0m\e[1;34m.\e[0m"]
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
603 call assert_equal(expected, getline(1,'$'), s:Mess(s:test))
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
604
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
605 call delete('Xinput')
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
606 call delete('XXDfile')
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
607
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
608 endfunc
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
609
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
610 func Test_xxd_color2()
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
611 CheckScreendump
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
612 CheckUnix
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
613 CheckNotMac
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
614 CheckNotBSD
33199
3395f1cbe3ab patch 9.0.1878: tests running sh have problems
Christian Brabandt <cb@256bit.org>
parents: 33122
diff changeset
615 CheckExecutable dash
33083
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
616
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
617 "Note Quotation mark escaped
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
618 "Note Aposhpere vaihdettu apostrophe replaced with 0x00
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
619 "Note Backslash replaced with 0x00
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
620 let data = [
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
621 \ "00000000: 0001 0203 0405 0607 0809 0a0b 0c0d 0e0f ................",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
622 \ "00000010: 1011 1213 1415 1617 1819 1a1b 1c1d 1e1f ................",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
623 \ "00000020: 2021 2223 2425 2600 2829 2a2b 2c2d 2e2f !\"#$%&.()*+,-./",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
624 \ "00000030: 3031 3233 3435 3637 3839 3a3b 3c3d 3e3f 0123456789:;<=>?",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
625 \ "00000040: 4041 4243 4445 4647 4849 4a4b 4c4d 4e4f @ABCDEFGHIJKLMNO",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
626 \ "00000050: 5051 5253 5455 5657 5859 5a5b 005d 5e5f PQRSTUVWXYZ[.]^_",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
627 \ "00000060: 6061 6263 6465 6667 6869 6a6b 6c6d 6e6f `abcdefghijklmno",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
628 \ "00000070: 7071 7273 7475 7677 7879 7a7b 7c7d 7e7f pqrstuvwxyz{|}~.",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
629 \ "00000080: 8081 8283 8485 8687 8889 8a8b 8c8d 8e8f ................",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
630 \ "00000090: 9091 9293 9495 9697 9899 9a9b 9c9d 9e9f ................",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
631 \ "000000a0: a0a1 a2a3 a4a5 a6a7 a8a9 aaab acad aeaf ................",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
632 \ "000000b0: b0b1 b2b3 b4b5 b6b7 b8b9 babb bcbd bebf ................",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
633 \ "000000c0: c0c1 c2c3 c4c5 c6c7 c8c9 cacb cccd cecf ................",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
634 \ "000000d0: d0d1 d2d3 d4d5 d6d7 d8d9 dadb dcdd dedf ................",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
635 \ "000000e0: e0e1 e2e3 e4e5 e6e7 e8e9 eaeb eced eeef ................",
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
636 \ "000000f0: f0f1 f2f3 f4f5 f6f7 f8f9 fafb fcfd feff ................"]
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
637 call writefile(data, 'Xinput', 'D')
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
638
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
639 call system(s:xxd_cmd .. ' -r < Xinput > XXDfile_colors')
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
640
33122
2946268e7c48 patch 9.0.1843: xxd color test flaky
Christian Brabandt <cb@256bit.org>
parents: 33083
diff changeset
641 let $PS1='$ '
33199
3395f1cbe3ab patch 9.0.1878: tests running sh have problems
Christian Brabandt <cb@256bit.org>
parents: 33122
diff changeset
642 " This needs dash, plain bashs sh does not seem to work :(
33083
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
643 let buf = RunVimInTerminal('', #{rows: 20, cmd: 'sh'})
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
644 call term_sendkeys(buf, s:xxd_cmd .. " -R never < XXDfile_colors\<cr>")
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
645 call TermWait(buf)
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
646 call VerifyScreenDump(buf, 'Test_xxd_color_0', {})
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
647
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
648 call TermWait(buf)
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
649 call term_sendkeys(buf, "clear\<CR>")
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
650 call term_sendkeys(buf, s:xxd_cmd .. " -R always < XXDfile_colors\<cr>")
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
651 call TermWait(buf)
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
652 call VerifyScreenDump(buf, 'Test_xxd_color_1', {})
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
653
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
654 call term_sendkeys(buf, "exit\<CR>")
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
655
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
656 call delete('XXDfile_colors')
33122
2946268e7c48 patch 9.0.1843: xxd color test flaky
Christian Brabandt <cb@256bit.org>
parents: 33083
diff changeset
657 unlet! $PS1
33083
79b2eb83f2df patch 9.0.1827: xxd: no color support
Christian Brabandt <cb@256bit.org>
parents: 32104
diff changeset
658 endfunc
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 20784
diff changeset
659 " vim: shiftwidth=2 sts=2 expandtab