diff options
author | Lucas Hoffmann <l-m-h@web.de> | 2015-06-11 12:33:09 +0200 |
---|---|---|
committer | Lucas Hoffmann <l-m-h@web.de> | 2016-05-23 10:39:24 +0200 |
commit | 1e1325bd1826c057a589fc64b199daab13ea4ecf (patch) | |
tree | 4913ead18ee958f40852582e67e080a8411ea960 | |
parent | 176f223ea3d1e8fb5716d5c2c0f09bead4864d59 (diff) | |
download | rneovim-1e1325bd1826c057a589fc64b199daab13ea4ecf.tar.gz rneovim-1e1325bd1826c057a589fc64b199daab13ea4ecf.tar.bz2 rneovim-1e1325bd1826c057a589fc64b199daab13ea4ecf.zip |
tests: Migrate legacy test listlbr.
-rw-r--r-- | src/nvim/testdir/Makefile | 1 | ||||
-rw-r--r-- | src/nvim/testdir/test_listlbr.in | 119 | ||||
-rw-r--r-- | src/nvim/testdir/test_listlbr.ok | 62 | ||||
-rw-r--r-- | test/functional/legacy/listlbr_spec.lua | 136 |
4 files changed, 136 insertions, 182 deletions
diff --git a/src/nvim/testdir/Makefile b/src/nvim/testdir/Makefile index 2fba6dd563..18ecabeade 100644 --- a/src/nvim/testdir/Makefile +++ b/src/nvim/testdir/Makefile @@ -31,7 +31,6 @@ SCRIPTS := \ test69.out \ test73.out \ test79.out \ - test_listlbr.out \ test_marks.out \ # Tests using runtest.vim.vim. diff --git a/src/nvim/testdir/test_listlbr.in b/src/nvim/testdir/test_listlbr.in deleted file mode 100644 index b5bac080ee..0000000000 --- a/src/nvim/testdir/test_listlbr.in +++ /dev/null @@ -1,119 +0,0 @@ -Test for linebreak and list option (non-utf8) - -STARTTEST -:if !exists("+linebreak") | e! test.ok | w! test.out | qa! | endif -:set wildchar=^E -:10new|:vsp|:vert resize 20 -:put =\"\tabcdef hijklmn\tpqrstuvwxyz_1060ABCDEFGHIJKLMNOP \" -:norm! zt -:set ts=4 sw=4 sts=4 linebreak sbr=+ wrap -:fu! ScreenChar(width) -: let c='' -: for j in range(1,4) -: for i in range(1,a:width) -: let c.=nr2char(screenchar(j, i)) -: endfor -: let c.="\n" -: endfor -: return c -:endfu -:fu! DoRecordScreen() -: wincmd l -: $put =printf(\"\n%s\", g:test) -: $put =g:line -: wincmd p -:endfu -:" -:let g:test="Test 1: set linebreak" -:redraw! -:let line=ScreenChar(winwidth(0)) -:call DoRecordScreen() -:" -:let g:test="Test 2: set linebreak + set list" -:set linebreak list listchars= -:redraw! -:let line=ScreenChar(winwidth(0)) -:call DoRecordScreen() -:" -:let g:test ="Test 3: set linebreak nolist" -:set nolist linebreak -:redraw! -:let line=ScreenChar(winwidth(0)) -:call DoRecordScreen() -:" -:let g:test ="Test 4: set linebreak with tab and 1 line as long as screen: should break!" -:set nolist linebreak ts=8 -:let line="1\t".repeat('a', winwidth(0)-2) -:$put =line -:$ -:norm! zt -:redraw! -:let line=ScreenChar(winwidth(0)) -:call DoRecordScreen() -:let line="_S_\t bla" -:$put =line -:$ -:norm! zt -:" -:let g:test ="Test 5: set linebreak with conceal and set list and tab displayed by different char (line may not be truncated)" -:set cpo&vim list linebreak conceallevel=2 concealcursor=nv listchars=tab:ab -:syn match ConcealVar contained /_/ conceal -:syn match All /.*/ contains=ConcealVar -:let line=ScreenChar(winwidth(0)) -:call DoRecordScreen() -:set cpo&vim linebreak -:" -:let g:test ="Test 6: set linebreak with visual block mode" -:let line="REMOVE: this not" -:$put =g:test -:$put =line -:let line="REMOVE: aaaaaaaaaaaaa" -:$put =line -:1/^REMOVE: -0jf x:$put -:set cpo&vim linebreak -:" -:let g:test ="Test 7: set linebreak with visual block mode and v_b_A" -:$put =g:test -Golong line: 40afoobar aTARGET at end -:exe "norm! $3B\<C-v>eAx\<Esc>" -:set cpo&vim linebreak sbr= -:" -:let g:test ="Test 8: set linebreak with visual char mode and changing block" -:$put =g:test -Go1111-1111-1111-11-1111-1111-11110f-lv3lc2222bgj. -:" -:let g:test ="Test 9: using redo after block visual mode" -:$put =g:test -Go -aaa -aaa -a2k2j~e. -:" -:let g:test ="Test 10: using normal commands after block-visual" -:$put =g:test -:set linebreak -Go -abcd{ef -ghijklm -no}pqrs2k0f{c% -:" -:let g:test ="Test 11: using block replace mode after wrapping" -:$put =g:test -:set linebreak wrap -Go150aayypk147|jr0 -:" -:let g:test ="Test 12: set linebreak list listchars=space:_,tab:>-,tail:-,eol:$" -:set list listchars=space:_,trail:-,tab:>-,eol:$ -:$put =g:test -:let line="a aaaaaaaaaaaaaaaaaaaaaa\ta " -:$put =line -:$ -:norm! zt -:redraw! -:let line=ScreenChar(winwidth(0)) -:call DoRecordScreen() -:%w! test.out -:qa! -ENDTEST -dummy text diff --git a/src/nvim/testdir/test_listlbr.ok b/src/nvim/testdir/test_listlbr.ok deleted file mode 100644 index b32a54969e..0000000000 --- a/src/nvim/testdir/test_listlbr.ok +++ /dev/null @@ -1,62 +0,0 @@ - - abcdef hijklmn pqrstuvwxyz_1060ABCDEFGHIJKLMNOP - -Test 1: set linebreak - abcdef -+hijklmn -+pqrstuvwxyz_1060ABC -+DEFGHIJKLMNOP - -Test 2: set linebreak + set list -^Iabcdef hijklmn^I -+pqrstuvwxyz_1060ABC -+DEFGHIJKLMNOP - - -Test 3: set linebreak nolist - abcdef -+hijklmn -+pqrstuvwxyz_1060ABC -+DEFGHIJKLMNOP -1 aaaaaaaaaaaaaaaaaa - -Test 4: set linebreak with tab and 1 line as long as screen: should break! -1 -+aaaaaaaaaaaaaaaaaa -~ -~ -_S_ bla - -Test 5: set linebreak with conceal and set list and tab displayed by different char (line may not be truncated) -Sabbbbbb bla -~ -~ -~ -Test 6: set linebreak with visual block mode -this not -aaaaaaaaaaaaa -REMOVE: -REMOVE: -Test 7: set linebreak with visual block mode and v_b_A -long line: foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar TARGETx at end -Test 8: set linebreak with visual char mode and changing block -1111-2222-1111-11-1111-2222-1111 -Test 9: using redo after block visual mode - -AaA -AaA -A -Test 10: using normal commands after block-visual - -abcdpqrs -Test 11: using block replace mode after wrapping -aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa0aaa -aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa0aaa -Test 12: set linebreak list listchars=space:_,tab:>-,tail:-,eol:$ -a aaaaaaaaaaaaaaaaaaaaaa a - -Test 12: set linebreak list listchars=space:_,tab:>-,tail:-,eol:$ -a_ -aaaaaaaaaaaaaaaaaaaa -aa>-----a-$ -~ diff --git a/test/functional/legacy/listlbr_spec.lua b/test/functional/legacy/listlbr_spec.lua new file mode 100644 index 0000000000..8b3f00aa62 --- /dev/null +++ b/test/functional/legacy/listlbr_spec.lua @@ -0,0 +1,136 @@ +-- Test for linebreak and list option (non-utf8) + +local helpers = require('test.functional.helpers') +local feed, insert = helpers.feed, helpers.insert +local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect + +describe('listlbr', function() + setup(clear) + + it('is working', function() + insert([=[ + dummy text]=]) + + execute('set wildchar=^E') + execute('10new') + execute('vsp') + execute('vert resize 20') + execute([[put =\"\tabcdef hijklmn\tpqrstuvwxyz_1060ABCDEFGHIJKLMNOP \"]]) + execute('norm! zt') + execute('set ts=4 sw=4 sts=4 linebreak sbr=+ wrap') + execute('fu! ScreenChar(width)') + execute([[ let c='']]) + execute(' for j in range(1,4)') + execute(' for i in range(1,a:width)') + execute(' let c.=nr2char(screenchar(j, i))') + execute(' endfor') + execute([[ let c.="\n"]]) + execute(' endfor') + execute(' return c') + execute('endfu') + execute('fu! DoRecordScreen()') + execute(' wincmd l') + execute([[ $put =printf(\"\n%s\", g:test)]]) + execute(' $put =g:line') + execute(' wincmd p') + execute('endfu') + execute('let g:test="Test 1: set linebreak"') + execute('redraw!') + execute('let line=ScreenChar(winwidth(0))') + execute('call DoRecordScreen()') + execute('let g:test="Test 2: set linebreak + set list"') + execute('set linebreak list listchars=') + execute('redraw!') + execute('let line=ScreenChar(winwidth(0))') + execute('call DoRecordScreen()') + execute('let g:test ="Test 3: set linebreak nolist"') + execute('set nolist linebreak') + execute('redraw!') + execute('let line=ScreenChar(winwidth(0))') + execute('call DoRecordScreen()') + execute('let g:test ="Test 4: set linebreak with tab and 1 line as long as screen: should break!"') + execute('set nolist linebreak ts=8') + execute([[let line="1\t".repeat('a', winwidth(0)-2)]]) + execute('$put =line') + execute('$') + execute('norm! zt') + execute('redraw!') + execute('let line=ScreenChar(winwidth(0))') + execute('call DoRecordScreen()') + execute([[let line="_S_\t bla"]]) + execute('$put =line') + execute('$') + execute('norm! zt') + execute('let g:test ="Test 5: set linebreak with conceal and set list and tab displayed by different char (line may not be truncated)"') + execute('set cpo&vim list linebreak conceallevel=2 concealcursor=nv listchars=tab:ab') + execute('syn match ConcealVar contained /_/ conceal') + execute('syn match All /.*/ contains=ConcealVar') + execute('let line=ScreenChar(winwidth(0))') + execute('call DoRecordScreen()') + execute('set cpo&vim linebreak') + execute('let g:test ="Test 6: set linebreak with visual block mode"') + execute('let line="REMOVE: this not"') + execute('$put =g:test') + execute('$put =line') + execute('let line="REMOVE: aaaaaaaaaaaaa"') + execute('$put =line') + execute('1/^REMOVE:') + feed('0<C-V>jf x') + execute('$put') + execute('set cpo&vim linebreak') + execute('let g:test ="Test 7: set linebreak with visual block mode and v_b_A"') + execute('$put =g:test') + feed('Golong line: <esc>40afoobar <esc>aTARGET at end<esc>') + execute([[exe "norm! $3B\<C-v>eAx\<Esc>"]]) + execute('set cpo&vim linebreak sbr=') + execute('let g:test ="Test 8: set linebreak with visual char mode and changing block"') + execute('$put =g:test') + feed('Go1111-1111-1111-11-1111-1111-1111<esc>0f-lv3lc2222<esc>bgj.') + + -- Assert buffer contents. + expect([=[ + + abcdef hijklmn pqrstuvwxyz_1060ABCDEFGHIJKLMNOP + + Test 1: set linebreak + abcdef + +hijklmn + +pqrstuvwxyz_1060ABC + +DEFGHIJKLMNOP + + Test 2: set linebreak + set list + ^Iabcdef hijklmn^I + +pqrstuvwxyz_1060ABC + +DEFGHIJKLMNOP + + + Test 3: set linebreak nolist + abcdef + +hijklmn + +pqrstuvwxyz_1060ABC + +DEFGHIJKLMNOP + 1 aaaaaaaaaaaaaaaaaa + + Test 4: set linebreak with tab and 1 line as long as screen: should break! + 1 + +aaaaaaaaaaaaaaaaaa + ~ + ~ + _S_ bla + + Test 5: set linebreak with conceal and set list and tab displayed by different char (line may not be truncated) + Sabbbbbb bla + ~ + ~ + ~ + Test 6: set linebreak with visual block mode + this not + aaaaaaaaaaaaa + REMOVE: + REMOVE: + Test 7: set linebreak with visual block mode and v_b_A + long line: foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar TARGETx at end + Test 8: set linebreak with visual char mode and changing block + 1111-2222-1111-11-1111-2222-1111]=]) + end) +end) |