1" Tests for defining text property types and adding text properties to the
2" buffer.
3
4if !has('textprop')
5  finish
6endif
7
8source screendump.vim
9
10" test length zero
11
12func Test_proptype_global()
13  call prop_type_add('comment', {'highlight': 'Directory', 'priority': 123, 'start_incl': 1, 'end_incl': 1})
14  let proptypes = prop_type_list()
15  call assert_equal(1, len(proptypes))
16  call assert_equal('comment', proptypes[0])
17
18  let proptype = prop_type_get('comment')
19  call assert_equal('Directory', proptype['highlight'])
20  call assert_equal(123, proptype['priority'])
21  call assert_equal(1, proptype['start_incl'])
22  call assert_equal(1, proptype['end_incl'])
23
24  call prop_type_delete('comment')
25  call assert_equal(0, len(prop_type_list()))
26
27  call prop_type_add('one', {})
28  call assert_equal(1, len(prop_type_list()))
29  let proptype = prop_type_get('one')
30  call assert_false(has_key(proptype, 'highlight'))
31  call assert_equal(0, proptype['priority'])
32  call assert_equal(0, proptype['start_incl'])
33  call assert_equal(0, proptype['end_incl'])
34
35  call prop_type_add('two', {})
36  call assert_equal(2, len(prop_type_list()))
37  call prop_type_delete('one')
38  call assert_equal(1, len(prop_type_list()))
39  call prop_type_delete('two')
40  call assert_equal(0, len(prop_type_list()))
41endfunc
42
43func Test_proptype_buf()
44  let bufnr = bufnr('')
45  call prop_type_add('comment', {'bufnr': bufnr, 'highlight': 'Directory', 'priority': 123, 'start_incl': 1, 'end_incl': 1})
46  let proptypes = prop_type_list({'bufnr': bufnr})
47  call assert_equal(1, len(proptypes))
48  call assert_equal('comment', proptypes[0])
49
50  let proptype = prop_type_get('comment', {'bufnr': bufnr})
51  call assert_equal('Directory', proptype['highlight'])
52  call assert_equal(123, proptype['priority'])
53  call assert_equal(1, proptype['start_incl'])
54  call assert_equal(1, proptype['end_incl'])
55
56  call prop_type_delete('comment', {'bufnr': bufnr})
57  call assert_equal(0, len(prop_type_list({'bufnr': bufnr})))
58
59  call prop_type_add('one', {'bufnr': bufnr})
60  let proptype = prop_type_get('one', {'bufnr': bufnr})
61  call assert_false(has_key(proptype, 'highlight'))
62  call assert_equal(0, proptype['priority'])
63  call assert_equal(0, proptype['start_incl'])
64  call assert_equal(0, proptype['end_incl'])
65
66  call prop_type_add('two', {'bufnr': bufnr})
67  call assert_equal(2, len(prop_type_list({'bufnr': bufnr})))
68  call prop_type_delete('one', {'bufnr': bufnr})
69  call assert_equal(1, len(prop_type_list({'bufnr': bufnr})))
70  call prop_type_delete('two', {'bufnr': bufnr})
71  call assert_equal(0, len(prop_type_list({'bufnr': bufnr})))
72endfunc
73
74func AddPropTypes()
75  call prop_type_add('one', {})
76  call prop_type_add('two', {})
77  call prop_type_add('three', {})
78  call prop_type_add('whole', {})
79endfunc
80
81func DeletePropTypes()
82  call prop_type_delete('one')
83  call prop_type_delete('two')
84  call prop_type_delete('three')
85  call prop_type_delete('whole')
86endfunc
87
88func SetupPropsInFirstLine()
89  call setline(1, 'one two three')
90  call prop_add(1, 1, {'length': 3, 'id': 11, 'type': 'one'})
91  call prop_add(1, 5, {'length': 3, 'id': 12, 'type': 'two'})
92  call prop_add(1, 9, {'length': 5, 'id': 13, 'type': 'three'})
93  call prop_add(1, 1, {'length': 13, 'id': 14, 'type': 'whole'})
94endfunc
95
96func Get_expected_props()
97  return [
98      \ {'col': 1, 'length': 13, 'id': 14, 'type': 'whole', 'start': 1, 'end': 1},
99      \ {'col': 1, 'length': 3, 'id': 11, 'type': 'one', 'start': 1, 'end': 1},
100      \ {'col': 5, 'length': 3, 'id': 12, 'type': 'two', 'start': 1, 'end': 1},
101      \ {'col': 9, 'length': 5, 'id': 13, 'type': 'three', 'start': 1, 'end': 1},
102      \ ]
103endfunc
104
105func Test_prop_add()
106  new
107  call AddPropTypes()
108  call SetupPropsInFirstLine()
109  let expected_props = Get_expected_props()
110  call assert_equal(expected_props, prop_list(1))
111  call assert_fails("call prop_add(10, 1, {'length': 1, 'id': 14, 'type': 'whole'})", 'E966:')
112  call assert_fails("call prop_add(1, 22, {'length': 1, 'id': 14, 'type': 'whole'})", 'E964:')
113
114  " Insert a line above, text props must still be there.
115  call append(0, 'empty')
116  call assert_equal(expected_props, prop_list(2))
117  " Delete a line above, text props must still be there.
118  1del
119  call assert_equal(expected_props, prop_list(1))
120
121  " Prop without length or end column is zero length
122  call prop_clear(1)
123  call prop_add(1, 5, {'type': 'two'})
124  let expected = [{'col': 5, 'length': 0, 'type': 'two', 'id': 0, 'start': 1, 'end': 1}]
125  call assert_equal(expected, prop_list(1))
126
127  call DeletePropTypes()
128  bwipe!
129endfunc
130
131func Test_prop_remove()
132  new
133  call AddPropTypes()
134  call SetupPropsInFirstLine()
135  let props = Get_expected_props()
136  call assert_equal(props, prop_list(1))
137
138  " remove by id
139  call prop_remove({'id': 12}, 1)
140  unlet props[2]
141  call assert_equal(props, prop_list(1))
142
143  " remove by type
144  call prop_remove({'type': 'one'}, 1)
145  unlet props[1]
146  call assert_equal(props, prop_list(1))
147
148  call DeletePropTypes()
149  bwipe!
150endfunc
151
152func SetupOneLine()
153  call setline(1, 'xonex xtwoxx')
154  normal gg0
155  call AddPropTypes()
156  call prop_add(1, 2, {'length': 3, 'id': 11, 'type': 'one'})
157  call prop_add(1, 8, {'length': 3, 'id': 12, 'type': 'two'})
158  let expected = [
159	\ {'col': 2, 'length': 3, 'id': 11, 'type': 'one', 'start': 1, 'end': 1},
160	\ {'col': 8, 'length': 3, 'id': 12, 'type': 'two', 'start': 1, 'end': 1},
161	\]
162  call assert_equal(expected, prop_list(1))
163  return expected
164endfunc
165
166func Test_prop_add_remove_buf()
167  new
168  let bufnr = bufnr('')
169  call AddPropTypes()
170  for lnum in range(1, 4)
171    call setline(lnum, 'one two three')
172  endfor
173  wincmd w
174  for lnum in range(1, 4)
175    call prop_add(lnum, 1, {'length': 3, 'id': 11, 'type': 'one', 'bufnr': bufnr})
176    call prop_add(lnum, 5, {'length': 3, 'id': 12, 'type': 'two', 'bufnr': bufnr})
177    call prop_add(lnum, 11, {'length': 3, 'id': 13, 'type': 'three', 'bufnr': bufnr})
178  endfor
179
180  let props = [
181	\ {'col': 1, 'length': 3, 'id': 11, 'type': 'one', 'start': 1, 'end': 1},
182	\ {'col': 5, 'length': 3, 'id': 12, 'type': 'two', 'start': 1, 'end': 1},
183	\ {'col': 11, 'length': 3, 'id': 13, 'type': 'three', 'start': 1, 'end': 1},
184	\]
185  call assert_equal(props, prop_list(1, {'bufnr': bufnr}))
186
187  " remove by id
188  let before_props = deepcopy(props)
189  unlet props[1]
190
191  call prop_remove({'id': 12, 'bufnr': bufnr}, 1)
192  call assert_equal(props, prop_list(1, {'bufnr': bufnr}))
193  call assert_equal(before_props, prop_list(2, {'bufnr': bufnr}))
194  call assert_equal(before_props, prop_list(3, {'bufnr': bufnr}))
195  call assert_equal(before_props, prop_list(4, {'bufnr': bufnr}))
196
197  call prop_remove({'id': 12, 'bufnr': bufnr}, 3, 4)
198  call assert_equal(props, prop_list(1, {'bufnr': bufnr}))
199  call assert_equal(before_props, prop_list(2, {'bufnr': bufnr}))
200  call assert_equal(props, prop_list(3, {'bufnr': bufnr}))
201  call assert_equal(props, prop_list(4, {'bufnr': bufnr}))
202
203  call prop_remove({'id': 12, 'bufnr': bufnr})
204  for lnum in range(1, 4)
205    call assert_equal(props, prop_list(lnum, {'bufnr': bufnr}))
206  endfor
207
208  " remove by type
209  let before_props = deepcopy(props)
210  unlet props[0]
211
212  call prop_remove({'type': 'one', 'bufnr': bufnr}, 1)
213  call assert_equal(props, prop_list(1, {'bufnr': bufnr}))
214  call assert_equal(before_props, prop_list(2, {'bufnr': bufnr}))
215  call assert_equal(before_props, prop_list(3, {'bufnr': bufnr}))
216  call assert_equal(before_props, prop_list(4, {'bufnr': bufnr}))
217
218  call prop_remove({'type': 'one', 'bufnr': bufnr}, 3, 4)
219  call assert_equal(props, prop_list(1, {'bufnr': bufnr}))
220  call assert_equal(before_props, prop_list(2, {'bufnr': bufnr}))
221  call assert_equal(props, prop_list(3, {'bufnr': bufnr}))
222  call assert_equal(props, prop_list(4, {'bufnr': bufnr}))
223
224  call prop_remove({'type': 'one', 'bufnr': bufnr})
225  for lnum in range(1, 4)
226    call assert_equal(props, prop_list(lnum, {'bufnr': bufnr}))
227  endfor
228
229  call DeletePropTypes()
230  wincmd w
231  bwipe!
232endfunc
233
234func Test_prop_backspace()
235  new
236  set bs=2
237  let expected = SetupOneLine() " 'xonex xtwoxx'
238
239  exe "normal 0li\<BS>\<Esc>fxli\<BS>\<Esc>"
240  call assert_equal('one xtwoxx', getline(1))
241  let expected[0].col = 1
242  let expected[1].col = 6
243  call assert_equal(expected, prop_list(1))
244
245  call DeletePropTypes()
246  bwipe!
247  set bs&
248endfunc
249
250func Test_prop_replace()
251  new
252  set bs=2
253  let expected = SetupOneLine() " 'xonex xtwoxx'
254
255  exe "normal 0Ryyy\<Esc>"
256  call assert_equal('yyyex xtwoxx', getline(1))
257  call assert_equal(expected, prop_list(1))
258
259  exe "normal ftRyy\<BS>"
260  call assert_equal('yyyex xywoxx', getline(1))
261  call assert_equal(expected, prop_list(1))
262
263  exe "normal 0fwRyy\<BS>"
264  call assert_equal('yyyex xyyoxx', getline(1))
265  call assert_equal(expected, prop_list(1))
266
267  exe "normal 0foRyy\<BS>\<BS>"
268  call assert_equal('yyyex xyyoxx', getline(1))
269  call assert_equal(expected, prop_list(1))
270
271  call DeletePropTypes()
272  bwipe!
273  set bs&
274endfunc
275
276func Test_prop_open_line()
277  new
278
279  " open new line, props stay in top line
280  let expected = SetupOneLine() " 'xonex xtwoxx'
281  exe "normal o\<Esc>"
282  call assert_equal('xonex xtwoxx', getline(1))
283  call assert_equal('', getline(2))
284  call assert_equal(expected, prop_list(1))
285  call DeletePropTypes()
286
287  " move all props to next line
288  let expected = SetupOneLine() " 'xonex xtwoxx'
289  exe "normal 0i\<CR>\<Esc>"
290  call assert_equal('', getline(1))
291  call assert_equal('xonex xtwoxx', getline(2))
292  call assert_equal(expected, prop_list(2))
293  call DeletePropTypes()
294
295  " split just before prop, move all props to next line
296  let expected = SetupOneLine() " 'xonex xtwoxx'
297  exe "normal 0li\<CR>\<Esc>"
298  call assert_equal('x', getline(1))
299  call assert_equal('onex xtwoxx', getline(2))
300  let expected[0].col -= 1
301  let expected[1].col -= 1
302  call assert_equal(expected, prop_list(2))
303  call DeletePropTypes()
304
305  " split inside prop, split first prop
306  let expected = SetupOneLine() " 'xonex xtwoxx'
307  exe "normal 0lli\<CR>\<Esc>"
308  call assert_equal('xo', getline(1))
309  call assert_equal('nex xtwoxx', getline(2))
310  let exp_first = [deepcopy(expected[0])]
311  let exp_first[0].length = 1
312  call assert_equal(exp_first, prop_list(1))
313  let expected[0].col = 1
314  let expected[0].length = 2
315  let expected[1].col -= 2
316  call assert_equal(expected, prop_list(2))
317  call DeletePropTypes()
318
319  " split just after first prop, second prop move to next line
320  let expected = SetupOneLine() " 'xonex xtwoxx'
321  exe "normal 0fea\<CR>\<Esc>"
322  call assert_equal('xone', getline(1))
323  call assert_equal('x xtwoxx', getline(2))
324  let exp_first = expected[0:0]
325  call assert_equal(exp_first, prop_list(1))
326  let expected = expected[1:1]
327  let expected[0].col -= 4
328  call assert_equal(expected, prop_list(2))
329  call DeletePropTypes()
330
331  bwipe!
332  set bs&
333endfunc
334
335func Test_prop_clear()
336  new
337  call AddPropTypes()
338  call SetupPropsInFirstLine()
339  call assert_equal(Get_expected_props(), prop_list(1))
340
341  call prop_clear(1)
342  call assert_equal([], prop_list(1))
343
344  call DeletePropTypes()
345  bwipe!
346endfunc
347
348func Test_prop_clear_buf()
349  new
350  call AddPropTypes()
351  call SetupPropsInFirstLine()
352  let bufnr = bufnr('')
353  wincmd w
354  call assert_equal(Get_expected_props(), prop_list(1, {'bufnr': bufnr}))
355
356  call prop_clear(1, 1, {'bufnr': bufnr})
357  call assert_equal([], prop_list(1, {'bufnr': bufnr}))
358
359  wincmd w
360  call DeletePropTypes()
361  bwipe!
362endfunc
363
364func Test_prop_setline()
365  new
366  call AddPropTypes()
367  call SetupPropsInFirstLine()
368  call assert_equal(Get_expected_props(), prop_list(1))
369
370  call setline(1, 'foobar')
371  call assert_equal([], prop_list(1))
372
373  call DeletePropTypes()
374  bwipe!
375endfunc
376
377func Test_prop_setbufline()
378  new
379  call AddPropTypes()
380  call SetupPropsInFirstLine()
381  let bufnr = bufnr('')
382  wincmd w
383  call assert_equal(Get_expected_props(), prop_list(1, {'bufnr': bufnr}))
384
385  call setbufline(bufnr, 1, 'foobar')
386  call assert_equal([], prop_list(1, {'bufnr': bufnr}))
387
388  wincmd w
389  call DeletePropTypes()
390  bwipe!
391endfunc
392
393func Test_prop_substitute()
394  new
395  " Set first line to 'one two three'
396  call AddPropTypes()
397  call SetupPropsInFirstLine()
398  let expected_props = Get_expected_props()
399  call assert_equal(expected_props, prop_list(1))
400
401  " Change "n" in "one" to XX: 'oXXe two three'
402  s/n/XX/
403  let expected_props[0].length += 1
404  let expected_props[1].length += 1
405  let expected_props[2].col += 1
406  let expected_props[3].col += 1
407  call assert_equal(expected_props, prop_list(1))
408
409  " Delete "t" in "two" and "three" to XX: 'oXXe wo hree'
410  s/t//g
411  let expected_props[0].length -= 2
412  let expected_props[2].length -= 1
413  let expected_props[3].length -= 1
414  let expected_props[3].col -= 1
415  call assert_equal(expected_props, prop_list(1))
416
417  " Split the line by changing w to line break: 'oXXe ', 'o hree'
418  " The long prop is split and spans both lines.
419  " The props on "two" and "three" move to the next line.
420  s/w/\r/
421  let new_props = [
422	\ copy(expected_props[0]),
423	\ copy(expected_props[2]),
424	\ copy(expected_props[3]),
425	\ ]
426  let expected_props[0].length = 5
427  unlet expected_props[3]
428  unlet expected_props[2]
429  call assert_equal(expected_props, prop_list(1))
430
431  let new_props[0].length = 6
432  let new_props[1].col = 1
433  let new_props[1].length = 1
434  let new_props[2].col = 3
435  call assert_equal(new_props, prop_list(2))
436
437  call DeletePropTypes()
438  bwipe!
439endfunc
440
441func Test_prop_change_indent()
442  call prop_type_add('comment', {'highlight': 'Directory'})
443  new
444  call setline(1, ['    xxx', 'yyyyy'])
445  call prop_add(2, 2, {'length': 2, 'type': 'comment'})
446  let expect = {'col': 2, 'length': 2, 'type': 'comment', 'start': 1, 'end': 1, 'id': 0}
447  call assert_equal([expect], prop_list(2))
448
449  set shiftwidth=3
450  normal 2G>>
451  call assert_equal('   yyyyy', getline(2))
452  let expect.col += 3
453  call assert_equal([expect], prop_list(2))
454
455  normal 2G==
456  call assert_equal('    yyyyy', getline(2))
457  let expect.col = 6
458  call assert_equal([expect], prop_list(2))
459
460  call prop_clear(2)
461  call prop_add(2, 2, {'length': 5, 'type': 'comment'})
462  let expect.col = 2
463  let expect.length = 5
464  call assert_equal([expect], prop_list(2))
465
466  normal 2G<<
467  call assert_equal(' yyyyy', getline(2))
468  let expect.length = 2
469  call assert_equal([expect], prop_list(2))
470
471  set shiftwidth&
472  call prop_type_delete('comment')
473endfunc
474
475" Setup a three line prop in lines 2 - 4.
476" Add short props in line 1 and 5.
477func Setup_three_line_prop()
478  new
479  call setline(1, ['one', 'twotwo', 'three', 'fourfour', 'five'])
480  call prop_add(1, 2, {'length': 1, 'type': 'comment'})
481  call prop_add(2, 4, {'end_lnum': 4, 'end_col': 5, 'type': 'comment'})
482  call prop_add(5, 2, {'length': 1, 'type': 'comment'})
483endfunc
484
485func Test_prop_multiline()
486  call prop_type_add('comment', {'highlight': 'Directory'})
487  new
488  call setline(1, ['xxxxxxx', 'yyyyyyyyy', 'zzzzzzzz'])
489
490  " start halfway line 1, end halfway line 3
491  call prop_add(1, 3, {'end_lnum': 3, 'end_col': 5, 'type': 'comment'})
492  let expect1 = {'col': 3, 'length': 6, 'type': 'comment', 'start': 1, 'end': 0, 'id': 0}
493  call assert_equal([expect1], prop_list(1))
494  let expect2 = {'col': 1, 'length': 10, 'type': 'comment', 'start': 0, 'end': 0, 'id': 0}
495  call assert_equal([expect2], prop_list(2))
496  let expect3 = {'col': 1, 'length': 4, 'type': 'comment', 'start': 0, 'end': 1, 'id': 0}
497  call assert_equal([expect3], prop_list(3))
498  call prop_clear(1, 3)
499
500  " include all three lines
501  call prop_add(1, 1, {'end_lnum': 3, 'end_col': 999, 'type': 'comment'})
502  let expect1.col = 1
503  let expect1.length = 8
504  call assert_equal([expect1], prop_list(1))
505  call assert_equal([expect2], prop_list(2))
506  let expect3.length = 9
507  call assert_equal([expect3], prop_list(3))
508  call prop_clear(1, 3)
509
510  bwipe!
511
512  " Test deleting the first line of a multi-line prop.
513  call Setup_three_line_prop()
514  let expect_short = {'col': 2, 'length': 1, 'type': 'comment', 'start': 1, 'end': 1, 'id': 0}
515  call assert_equal([expect_short], prop_list(1))
516  let expect2 = {'col': 4, 'length': 4, 'type': 'comment', 'start': 1, 'end': 0, 'id': 0}
517  call assert_equal([expect2], prop_list(2))
518  2del
519  call assert_equal([expect_short], prop_list(1))
520  let expect2 = {'col': 1, 'length': 6, 'type': 'comment', 'start': 1, 'end': 0, 'id': 0}
521  call assert_equal([expect2], prop_list(2))
522  bwipe!
523
524  " Test deleting the last line of a multi-line prop.
525  call Setup_three_line_prop()
526  let expect3 = {'col': 1, 'length': 6, 'type': 'comment', 'start': 0, 'end': 0, 'id': 0}
527  call assert_equal([expect3], prop_list(3))
528  let expect4 = {'col': 1, 'length': 4, 'type': 'comment', 'start': 0, 'end': 1, 'id': 0}
529  call assert_equal([expect4], prop_list(4))
530  4del
531  let expect3.end = 1
532  call assert_equal([expect3], prop_list(3))
533  call assert_equal([expect_short], prop_list(4))
534  bwipe!
535
536  " Test appending a line below the multi-line text prop start.
537  call Setup_three_line_prop()
538  let expect2 = {'col': 4, 'length': 4, 'type': 'comment', 'start': 1, 'end': 0, 'id': 0}
539  call assert_equal([expect2], prop_list(2))
540  call append(2, "new line")
541  call assert_equal([expect2], prop_list(2))
542  let expect3 = {'col': 1, 'length': 9, 'type': 'comment', 'start': 0, 'end': 0, 'id': 0}
543  call assert_equal([expect3], prop_list(3))
544  bwipe!
545
546  call prop_type_delete('comment')
547endfunc
548
549func Test_prop_byteoff()
550  call prop_type_add('comment', {'highlight': 'Directory'})
551  new
552  call setline(1, ['line1', 'second line', ''])
553  set ff=unix
554  call assert_equal(19, line2byte(3))
555  call prop_add(1, 1, {'end_col': 3, 'type': 'comment'})
556  call assert_equal(19, line2byte(3))
557
558  bwipe!
559  call prop_type_delete('comment')
560endfunc
561
562func Test_prop_undo()
563  new
564  call prop_type_add('comment', {'highlight': 'Directory'})
565  call setline(1, ['oneone', 'twotwo', 'three'])
566  " Set 'undolevels' to break changes into undo-able pieces.
567  set ul&
568
569  call prop_add(1, 3, {'end_col': 5, 'type': 'comment'})
570  let expected = [{'col': 3, 'length': 2, 'id': 0, 'type': 'comment', 'start': 1, 'end': 1} ]
571  call assert_equal(expected, prop_list(1))
572
573  " Insert a character, then undo.
574  exe "normal 0lllix\<Esc>"
575  set ul&
576  let expected[0].length = 3
577  call assert_equal(expected, prop_list(1))
578  undo
579  let expected[0].length = 2
580  call assert_equal(expected, prop_list(1))
581
582  " Delete a character, then undo
583  exe "normal 0lllx"
584  set ul&
585  let expected[0].length = 1
586  call assert_equal(expected, prop_list(1))
587  undo
588  let expected[0].length = 2
589  call assert_equal(expected, prop_list(1))
590
591  " Delete the line, then undo
592  1d
593  set ul&
594  call assert_equal([], prop_list(1))
595  undo
596  call assert_equal(expected, prop_list(1))
597
598  " Insert a character, delete two characters, then undo with "U"
599  exe "normal 0lllix\<Esc>"
600  set ul&
601  let expected[0].length = 3
602  call assert_equal(expected, prop_list(1))
603  exe "normal 0lllxx"
604  set ul&
605  let expected[0].length = 1
606  call assert_equal(expected, prop_list(1))
607  normal U
608  let expected[0].length = 2
609  call assert_equal(expected, prop_list(1))
610
611  bwipe!
612  call prop_type_delete('comment')
613endfunc
614
615" screenshot test with textprop highlighting
616funct Test_textprop_screenshots()
617  " The Vim running in the terminal needs to use utf-8.
618  if !CanRunVimInTerminal() || g:orig_encoding != 'utf-8'
619    return
620  endif
621  call writefile([
622	\ "call setline(1, ["
623	\	.. "'One two',"
624	\	.. "'Numbér 123 änd thœn 4¾7.',"
625	\	.. "'--aa--bb--cc--dd--',"
626	\	.. "'// comment with error in it',"
627	\	.. "])",
628	\ "hi NumberProp ctermfg=blue",
629	\ "hi LongProp ctermbg=yellow",
630	\ "hi BackgroundProp ctermbg=lightgrey",
631	\ "hi UnderlineProp cterm=underline",
632	\ "call prop_type_add('number', {'highlight': 'NumberProp'})",
633	\ "call prop_type_add('long', {'highlight': 'LongProp'})",
634	\ "call prop_type_add('start', {'highlight': 'NumberProp', 'start_incl': 1})",
635	\ "call prop_type_add('end', {'highlight': 'NumberProp', 'end_incl': 1})",
636	\ "call prop_type_add('both', {'highlight': 'NumberProp', 'start_incl': 1, 'end_incl': 1})",
637	\ "call prop_type_add('background', {'highlight': 'BackgroundProp', 'combine': 1})",
638	\ "call prop_type_add('error', {'highlight': 'UnderlineProp', 'combine': 1})",
639	\ "call prop_add(1, 4, {'end_lnum': 3, 'end_col': 3, 'type': 'long'})",
640	\ "call prop_add(2, 9, {'length': 3, 'type': 'number'})",
641	\ "call prop_add(2, 24, {'length': 4, 'type': 'number'})",
642	\ "call prop_add(3, 3, {'length': 2, 'type': 'number'})",
643	\ "call prop_add(3, 7, {'length': 2, 'type': 'start'})",
644	\ "call prop_add(3, 11, {'length': 2, 'type': 'end'})",
645	\ "call prop_add(3, 15, {'length': 2, 'type': 'both'})",
646	\ "call prop_add(4, 12, {'length': 10, 'type': 'background'})",
647	\ "call prop_add(4, 17, {'length': 5, 'type': 'error'})",
648	\ "set number",
649	\ "hi clear SpellBad",
650	\ "set spell",
651	\ "syn match Comment '//.*'",
652	\ "hi Comment ctermfg=green",
653	\ "normal 3G0llix\<Esc>lllix\<Esc>lllix\<Esc>lllix\<Esc>lllix\<Esc>lllix\<Esc>lllix\<Esc>lllix\<Esc>",
654	\ "normal 3G0lli\<BS>\<Esc>",
655	\], 'XtestProp')
656  let buf = RunVimInTerminal('-S XtestProp', {'rows': 7})
657  call VerifyScreenDump(buf, 'Test_textprop_01', {})
658
659  " clean up
660  call StopVimInTerminal(buf)
661  call delete('XtestProp')
662endfunc
663