forked from aniani/vim
patch 8.0.1302: still too many old style tests
Problem: Still too many old style tests.
Solution: Convert a few more tests to new style. (Yegappan Lakshmanan,
closes #2326)
This commit is contained in:
63
src/testdir/test_listchars.vim
Normal file
63
src/testdir/test_listchars.vim
Normal file
@@ -0,0 +1,63 @@
|
||||
" Tests for 'listchars' display with 'list' and :list
|
||||
|
||||
source view_util.vim
|
||||
|
||||
func Test_listchars()
|
||||
enew!
|
||||
set ff=unix
|
||||
set list
|
||||
|
||||
set listchars+=tab:>-,space:.,trail:<
|
||||
call append(0, [
|
||||
\ ' aa ',
|
||||
\ ' bb ',
|
||||
\ ' cccc ',
|
||||
\ 'dd ee ',
|
||||
\ ' '
|
||||
\ ])
|
||||
let expected = [
|
||||
\ '>-------aa>-----$',
|
||||
\ '..bb>---<<$',
|
||||
\ '...cccc><$',
|
||||
\ 'dd........ee<<>-$',
|
||||
\ '<$'
|
||||
\ ]
|
||||
redraw!
|
||||
for i in range(1, 5)
|
||||
call cursor(i, 1)
|
||||
call assert_equal([expected[i - 1]], ScreenLines(i, virtcol('$')))
|
||||
endfor
|
||||
|
||||
set listchars-=trail:<
|
||||
let expected = [
|
||||
\ '>-------aa>-----$',
|
||||
\ '..bb>---..$',
|
||||
\ '...cccc>.$',
|
||||
\ 'dd........ee..>-$',
|
||||
\ '.$'
|
||||
\ ]
|
||||
redraw!
|
||||
for i in range(1, 5)
|
||||
call cursor(i, 1)
|
||||
call assert_equal([expected[i - 1]], ScreenLines(i, virtcol('$')))
|
||||
endfor
|
||||
|
||||
set listchars+=trail:<
|
||||
set nolist
|
||||
normal ggdG
|
||||
call append(0, [
|
||||
\ ' fff ',
|
||||
\ ' gg ',
|
||||
\ ' h ',
|
||||
\ 'iii ',
|
||||
\ ])
|
||||
let l = split(execute("%list"), "\n")
|
||||
call assert_equal([
|
||||
\ '..fff>--<<$',
|
||||
\ '>-------gg>-----$',
|
||||
\ '.....h>-$',
|
||||
\ 'iii<<<<><<$', '$'], l)
|
||||
|
||||
enew!
|
||||
set listchars& ff&
|
||||
endfunc
|
||||
Reference in New Issue
Block a user