diff src/testdir/test_textprop.vim @ 17208:13d0753511fe v8.1.1603

patch 8.1.1603: crash when using unknown highlighting in text property commit https://github.com/vim/vim/commit/d74af4227b4e961bbab6ec9aa36512464434a1ad Author: Bram Moolenaar <Bram@vim.org> Date: Fri Jun 28 21:38:00 2019 +0200 patch 8.1.1603: crash when using unknown highlighting in text property Problem: Crash when using unknown highlighting in text property. Solution: Check for zero highlight ID.
author Bram Moolenaar <Bram@vim.org>
date Fri, 28 Jun 2019 21:45:05 +0200
parents a001a0d88d42
children 6f9cde96ee3c
line wrap: on
line diff
--- a/src/testdir/test_textprop.vim
+++ b/src/testdir/test_textprop.vim
@@ -792,6 +792,17 @@ func Test_textprop_empty_buffer()
   call prop_type_delete('comment')
 endfunc
 
+" Adding a text property with invalid highlight should be ignored.
+func Test_textprop_invalid_highlight()
+  call assert_fails("call prop_type_add('dni', {'highlight': 'DoesNotExist'})", 'E970:')
+  new
+  call setline(1, ['asdf','asdf'])
+  call prop_add(1, 1, {'length': 4, 'type': 'dni'})
+  redraw
+  bwipe!
+  call prop_type_delete('dni')
+endfunc
+
 " Adding a text property to an empty buffer and then editing another
 func Test_textprop_empty_buffer_next()
   call prop_type_add("xxx", {})