@@ -181,3 +181,44 @@ func Test_profile_errors()
181181 call assert_fails (" profile pause" , ' E750:' )
182182 call assert_fails (" profile continue" , ' E750:' )
183183endfunc
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
0 commit comments