Mercurial > vim
comparison src/testdir/test_profile.vim @ 12992:5532b5176870 v8.0.1372
patch 8.0.1372: profile log may be truncated halfway a character
commit https://github.com/vim/vim/commit/ac112f01a6930c9d15cf0360b657373699916bfd
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Dec 5 16:46:28 2017 +0100
patch 8.0.1372: profile log may be truncated halfway a character
Problem: Profile log may be truncated halfway a character.
Solution: Find the start of the character. (Ozaki Kiichi, closes https://github.com/vim/vim/issues/2385)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Tue, 05 Dec 2017 17:00:07 +0100 |
parents | 20aacdca367d |
children | 24109c2e0b0b |
comparison
equal
deleted
inserted
replaced
12991:0d7aa7f7b0aa | 12992:5532b5176870 |
---|---|
179 func Test_profile_errors() | 179 func Test_profile_errors() |
180 call assert_fails("profile func Foo", 'E750:') | 180 call assert_fails("profile func Foo", 'E750:') |
181 call assert_fails("profile pause", 'E750:') | 181 call assert_fails("profile pause", 'E750:') |
182 call assert_fails("profile continue", 'E750:') | 182 call assert_fails("profile continue", 'E750:') |
183 endfunc | 183 endfunc |
184 | |
185 func Test_profile_truncate_mbyte() | |
186 if !has('multi_byte') || &enc !=# 'utf-8' | |
187 return | |
188 endif | |
189 | |
190 let lines = [ | |
191 \ 'scriptencoding utf-8', | |
192 \ 'func! Foo()', | |
193 \ ' return [', | |
194 \ ' \ "' . join(map(range(0x4E00, 0x4E00 + 340), 'nr2char(v:val)'), '') . '",', | |
195 \ ' \ "' . join(map(range(0x4F00, 0x4F00 + 340), 'nr2char(v:val)'), '') . '",', | |
196 \ ' \ ]', | |
197 \ 'endfunc', | |
198 \ 'call Foo()', | |
199 \ ] | |
200 | |
201 call writefile(lines, 'Xprofile_file.vim') | |
202 call system(v:progpath | |
203 \ . ' -es --clean --cmd "set enc=utf-8"' | |
204 \ . ' -c "profile start Xprofile_file.log"' | |
205 \ . ' -c "profile file Xprofile_file.vim"' | |
206 \ . ' -c "so Xprofile_file.vim"' | |
207 \ . ' -c "qall!"') | |
208 call assert_equal(0, v:shell_error) | |
209 | |
210 split Xprofile_file.log | |
211 if &fenc != '' | |
212 call assert_equal('utf-8', &fenc) | |
213 endif | |
214 /func! Foo() | |
215 let lnum = line('.') | |
216 call assert_match('^\s*return \[$', getline(lnum + 1)) | |
217 call assert_match("\u4F52$", getline(lnum + 2)) | |
218 call assert_match("\u5052$", getline(lnum + 3)) | |
219 call assert_match('^\s*\\ \]$', getline(lnum + 4)) | |
220 bwipe! | |
221 | |
222 call delete('Xprofile_file.vim') | |
223 call delete('Xprofile_file.log') | |
224 endfunc |