File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -226,7 +226,7 @@ estack_sfile(estack_arg_T which UNUSED)
226226 ga_concat_len (& ga , type_name .string , type_name .length );
227227 // For class methods prepend "<class name>." to the function name.
228228 if (* class_name .string != NUL )
229- ga .ga_len += vim_snprintf_safelen (
229+ ga .ga_len += ( int ) vim_snprintf_safelen (
230230 (char * )ga .ga_data + ga .ga_len ,
231231 len - (size_t )ga .ga_len ,
232232 "<SNR>%d_%s." ,
@@ -236,7 +236,7 @@ estack_sfile(estack_arg_T which UNUSED)
236236 // For the bottom entry of <sfile>: do not add the line number, it is used in
237237 // <slnum>. Also leave it out when the number is not set.
238238 if (lnum != 0 )
239- ga .ga_len += vim_snprintf_safelen (
239+ ga .ga_len += ( int ) vim_snprintf_safelen (
240240 (char * )ga .ga_data + ga .ga_len ,
241241 len - (size_t )ga .ga_len ,
242242 "[%ld]" ,
@@ -246,7 +246,9 @@ estack_sfile(estack_arg_T which UNUSED)
246246 }
247247 }
248248
249- ga_append (& ga , NUL );
249+ // Only NUL-terminate when not returning NULL.
250+ if (ga .ga_data != NULL )
251+ ga_append (& ga , NUL );
250252 return (char_u * )ga .ga_data ;
251253#endif
252254}
Original file line number Diff line number Diff line change @@ -381,6 +381,19 @@ func Test_assert_fails_in_timer()
381381 call StopVimInTerminal (buf )
382382endfunc
383383
384+ " Check that a typed assert_equal() doesn't prepend an unnecessary ':'.
385+ func Test_assert_equal_typed ()
386+ let after = << trim END
387+ call feedkeys (" :call assert_equal(0, 1)\<CR> " , ' t' )
388+ call feedkeys (" :call writefile(v:errors, 'Xerrors')\<CR> " , ' t' )
389+ call feedkeys (" :qa!\<CR> " , ' t' )
390+ END
391+ call assert_equal (1 , RunVim ([], after, ' ' ))
392+ call assert_equal ([' Expected 0 but got 1' ], readfile (' Xerrors' ))
393+
394+ call delete (' Xerrors' )
395+ endfunc
396+
384397func Test_assert_beeps ()
385398 new
386399 call assert_equal (0 , assert_beeps (' normal h' ))
Original file line number Diff line number Diff line change @@ -734,6 +734,8 @@ static char *(features[]) =
734734
735735static int included_patches [] =
736736{ /* Add new patch number below this line */
737+ /**/
738+ 1987 ,
737739/**/
738740 1986 ,
739741/**/
You can’t perform that action at this time.
0 commit comments