Handle edge case in common prefix calculation

This commit is contained in:
Andy Stewart
2019-09-24 18:33:12 +01:00
parent ccd4972d23
commit 3405ad72b6
2 changed files with 6 additions and 0 deletions

View File

@@ -916,6 +916,9 @@ endfunction
function Test_common_prefix()
" zero length
call assert_equal(-1, gitgutter#diff_highlight#common_prefix('', 'foo'))
call assert_equal(-1, gitgutter#diff_highlight#common_prefix('foo', ''))
" nothing in common
call assert_equal(-1, gitgutter#diff_highlight#common_prefix('-abcde', '+pqrst'))
call assert_equal(-1, gitgutter#diff_highlight#common_prefix('abcde', 'pqrst'))