aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir/test_profile.vim
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2019-03-09 14:12:54 +0100
committerGitHub <noreply@github.com>2019-03-09 14:12:54 +0100
commit6eca56c6c5a994be77ad6fd28a3639d963cb7ffc (patch)
tree1f5d9c5c46cc490b12ced1e44bd1e1ca9ef31557 /src/nvim/testdir/test_profile.vim
parentf719247118119cd6cd8158f3fead995175b92566 (diff)
parentc1ee5e0694e00595bece82a05098cfa44bfe8fd4 (diff)
downloadrneovim-6eca56c6c5a994be77ad6fd28a3639d963cb7ffc.tar.gz
rneovim-6eca56c6c5a994be77ad6fd28a3639d963cb7ffc.tar.bz2
rneovim-6eca56c6c5a994be77ad6fd28a3639d963cb7ffc.zip
Merge #9003 'vim-patch:8.0.1372'
Diffstat (limited to 'src/nvim/testdir/test_profile.vim')
-rw-r--r--src/nvim/testdir/test_profile.vim41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_profile.vim b/src/nvim/testdir/test_profile.vim
index 4cbd800da5..8996e86b43 100644
--- a/src/nvim/testdir/test_profile.vim
+++ b/src/nvim/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 --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