diff options
author | Bram Moolenaar <Bram@vim.org> | 2017-12-05 16:46:28 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2017-12-05 16:46:28 +0100 |
commit | ac112f01a6930c9d15cf0360b657373699916bfd (patch) | |
tree | 716c6cd53266a5e69aab17a3c2a4545d1acb59ce /src/testdir/test_profile.vim | |
parent | feeb4d0901c7b16958e8f02ffcdac83b605b0b43 (diff) | |
download | vim-git-ac112f01a6930c9d15cf0360b657373699916bfd.tar.gz |
patch 8.0.1372: profile log may be truncated halfway a characterv8.0.1372
Problem: Profile log may be truncated halfway a character.
Solution: Find the start of the character. (Ozaki Kiichi, closes #2385)
Diffstat (limited to 'src/testdir/test_profile.vim')
-rw-r--r-- | src/testdir/test_profile.vim | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/testdir/test_profile.vim b/src/testdir/test_profile.vim index ab39bcb64..ee617760f 100644 --- a/src/testdir/test_profile.vim +++ b/src/testdir/test_profile.vim @@ -181,3 +181,44 @@ func Test_profile_errors() call assert_fails("profile pause", 'E750:') call assert_fails("profile continue", 'E750:') endfunc + +func Test_profile_truncate_mbyte() + if !has('multi_byte') || &enc !=# 'utf-8' + return + endif + + let lines = [ + \ 'scriptencoding utf-8', + \ 'func! Foo()', + \ ' return [', + \ ' \ "' . join(map(range(0x4E00, 0x4E00 + 340), 'nr2char(v:val)'), '') . '",', + \ ' \ "' . join(map(range(0x4F00, 0x4F00 + 340), 'nr2char(v:val)'), '') . '",', + \ ' \ ]', + \ 'endfunc', + \ 'call Foo()', + \ ] + + call writefile(lines, 'Xprofile_file.vim') + call system(v:progpath + \ . ' -es --clean --cmd "set enc=utf-8"' + \ . ' -c "profile start Xprofile_file.log"' + \ . ' -c "profile file Xprofile_file.vim"' + \ . ' -c "so Xprofile_file.vim"' + \ . ' -c "qall!"') + call assert_equal(0, v:shell_error) + + split Xprofile_file.log + if &fenc != '' + call assert_equal('utf-8', &fenc) + endif + /func! Foo() + let lnum = line('.') + call assert_match('^\s*return \[$', getline(lnum + 1)) + call assert_match("\u4F52$", getline(lnum + 2)) + call assert_match("\u5052$", getline(lnum + 3)) + call assert_match('^\s*\\ \]$', getline(lnum + 4)) + bwipe! + + call delete('Xprofile_file.vim') + call delete('Xprofile_file.log') +endfunc |