comparison src/testdir/test_xxd.vim @ 16720:9c90cf08cfa8 v8.1.1362

patch 8.1.1362: code and data in tests can be hard to read commit https://github.com/vim/vim/commit/c79745a82faeb5a6058e915ca49a4c69fa60ea01 Author: Bram Moolenaar <Bram@vim.org> Date: Mon May 20 22:12:34 2019 +0200 patch 8.1.1362: code and data in tests can be hard to read Problem: Code and data in tests can be hard to read. Solution: Use the new heredoc style. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/4400)
author Bram Moolenaar <Bram@vim.org>
date Mon, 20 May 2019 22:15:06 +0200
parents f7b88b1d3350
children f38fcbf343ce
comparison
equal deleted inserted replaced
16719:27f2a2799604 16720:9c90cf08cfa8
93 let s:test += 1 93 let s:test += 1
94 call writefile(['TESTabcd09'], 'XXDfile') 94 call writefile(['TESTabcd09'], 'XXDfile')
95 %d 95 %d
96 exe '0r! ' . s:xxd_cmd . ' -i XXDfile' 96 exe '0r! ' . s:xxd_cmd . ' -i XXDfile'
97 $d 97 $d
98 let expected = ['unsigned char XXDfile[] = {', 98 let expected =<< trim [CODE]
99 \ ' 0x54, 0x45, 0x53, 0x54, 0x61, 0x62, 0x63, 0x64, 0x30, 0x39, 0x0a', '};', 99 unsigned char XXDfile[] = {
100 \ 'unsigned int XXDfile_len = 11;'] 100 0x54, 0x45, 0x53, 0x54, 0x61, 0x62, 0x63, 0x64, 0x30, 0x39, 0x0a
101 };
102 unsigned int XXDfile_len = 11;
103 [CODE]
104
101 call assert_equal(expected, getline(1,'$'), s:Mess(s:test)) 105 call assert_equal(expected, getline(1,'$'), s:Mess(s:test))
102 106
103 " Test 8: Print C include capitalized 107 " Test 8: Print C include capitalized
104 let s:test += 1 108 let s:test += 1
105 for arg in ['-C', '-capitalize'] 109 for arg in ['-C', '-capitalize']
106 call writefile(['TESTabcd09'], 'XXDfile') 110 call writefile(['TESTabcd09'], 'XXDfile')
107 %d 111 %d
108 exe '0r! ' . s:xxd_cmd . ' -i ' . arg . ' XXDfile' 112 exe '0r! ' . s:xxd_cmd . ' -i ' . arg . ' XXDfile'
109 $d 113 $d
110 let expected = ['unsigned char XXDFILE[] = {', 114 let expected =<< trim [CODE]
111 \ ' 0x54, 0x45, 0x53, 0x54, 0x61, 0x62, 0x63, 0x64, 0x30, 0x39, 0x0a', '};', 115 unsigned char XXDFILE[] = {
112 \ 'unsigned int XXDFILE_LEN = 11;'] 116 0x54, 0x45, 0x53, 0x54, 0x61, 0x62, 0x63, 0x64, 0x30, 0x39, 0x0a
117 };
118 unsigned int XXDFILE_LEN = 11;
119 [CODE]
113 call assert_equal(expected, getline(1,'$'), s:Mess(s:test)) 120 call assert_equal(expected, getline(1,'$'), s:Mess(s:test))
114 endfor 121 endfor
115 122
116 " Test 9: Create a file with containing a single 'A' 123 " Test 9: Create a file with containing a single 'A'
117 let s:test += 1 124 let s:test += 1