diff options
author | Thiago de Arruda <tpadilha84@gmail.com> | 2014-11-04 12:59:09 -0300 |
---|---|---|
committer | Thiago de Arruda <tpadilha84@gmail.com> | 2014-11-04 12:59:09 -0300 |
commit | 04633e3e6bb0da1489050fee2c7514f9a1808327 (patch) | |
tree | ddd4aa89a5f579d054c9627bd2d7cd8a19134767 | |
parent | 1d250cddb87546c0470462738d546c9d061dff56 (diff) | |
parent | a695c8786377d2399ca2472df183bdc2d32f4048 (diff) | |
download | rneovim-04633e3e6bb0da1489050fee2c7514f9a1808327.tar.gz rneovim-04633e3e6bb0da1489050fee2c7514f9a1808327.tar.bz2 rneovim-04633e3e6bb0da1489050fee2c7514f9a1808327.zip |
Merge PR #1328 'Migrate legacy tests'
71 files changed, 986 insertions, 578 deletions
diff --git a/src/nvim/testdir/test102.in b/src/nvim/testdir/test102.in deleted file mode 100644 index 35e9f6c2cf..0000000000 --- a/src/nvim/testdir/test102.in +++ /dev/null @@ -1,12 +0,0 @@ -Test if fnameescape is correct for special chars like ! - -STARTTEST -:%d -:let fname = 'Xspa ce' -:try | exe "w! " . fnameescape(fname) | put='Space' | endtry -:let fname = 'Xemark!' -:try | exe "w! " . fnameescape(fname) | put='ExclamationMark' | endtry -:w! test.out -:qa! -ENDTEST - diff --git a/src/nvim/testdir/test102.ok b/src/nvim/testdir/test102.ok deleted file mode 100644 index a25fea192c..0000000000 --- a/src/nvim/testdir/test102.ok +++ /dev/null @@ -1,3 +0,0 @@ - -Space -ExclamationMark diff --git a/src/nvim/testdir/test106.in b/src/nvim/testdir/test106.in deleted file mode 100644 index eb99e650ae..0000000000 --- a/src/nvim/testdir/test106.in +++ /dev/null @@ -1,16 +0,0 @@ -Tests for errorformat. vim: set ft=vim ts=8 : - -STARTTEST -:so small.vim -:if !has('quickfix') | e! test.ok | wq! test.out | endif -:set efm=%EEEE%m,%WWWW%m,%+CCCC%.%#,%-GGGG%.%# -:cgetexpr ['WWWW', 'EEEE', 'CCCC'] -:$put =strtrans(string(map(getqflist(), '[v:val.text, v:val.valid]'))) -:cgetexpr ['WWWW', 'GGGG', 'EEEE', 'CCCC'] -:$put =strtrans(string(map(getqflist(), '[v:val.text, v:val.valid]'))) -:cgetexpr ['WWWW', 'GGGG', 'ZZZZ', 'EEEE', 'CCCC', 'YYYY'] -:$put =strtrans(string(map(getqflist(), '[v:val.text, v:val.valid]'))) -:/^Results/,$wq! test.out -ENDTEST - -Results of test106: diff --git a/src/nvim/testdir/test106.ok b/src/nvim/testdir/test106.ok deleted file mode 100644 index 0a18cecf1c..0000000000 --- a/src/nvim/testdir/test106.ok +++ /dev/null @@ -1,4 +0,0 @@ -Results of test106: -[['W', 1], ['E^@CCCC', 1]] -[['W', 1], ['E^@CCCC', 1]] -[['W', 1], ['ZZZZ', 0], ['E^@CCCC', 1], ['YYYY', 0]] diff --git a/src/nvim/testdir/test18.in b/src/nvim/testdir/test18.in deleted file mode 100644 index 9bfd922344..0000000000 --- a/src/nvim/testdir/test18.in +++ /dev/null @@ -1,16 +0,0 @@ -Tests for not doing smart indenting when it isn't set. - -STARTTEST -:so small.vim -:set nocin nosi ai -/some -2cc#test -:?start?,$w! test.out -:qa! -ENDTEST - -start text - some test text - test text -test text - test text diff --git a/src/nvim/testdir/test18.ok b/src/nvim/testdir/test18.ok deleted file mode 100644 index e719713785..0000000000 --- a/src/nvim/testdir/test18.ok +++ /dev/null @@ -1,4 +0,0 @@ -start text - #test -test text - test text diff --git a/src/nvim/testdir/test20.in b/src/nvim/testdir/test20.in deleted file mode 100644 index 662a1439f2..0000000000 --- a/src/nvim/testdir/test20.in +++ /dev/null @@ -1,28 +0,0 @@ -Tests Blockwise Visual when there are TABs before the text. -First test for undo working properly when executing commands from a register. -Also test this in an empty buffer. - -STARTTEST -:so tiny.vim -G0"ay$k@au -:new -@auY:quit! -GP -/start here$ -"by$jjlld -/456$ -jj"bP -:/56$/,$-1w! test.out -:qa! -ENDTEST - -123456 -234567 -345678 - -test text test tex start here - some text - test text -test text - -OxjAykdd diff --git a/src/nvim/testdir/test20.ok b/src/nvim/testdir/test20.ok deleted file mode 100644 index 7c50ea8db8..0000000000 --- a/src/nvim/testdir/test20.ok +++ /dev/null @@ -1,10 +0,0 @@ -123start here56 -234start here67 -345start here78 - -test text test tex rt here - somext - tesext -test text - - diff --git a/src/nvim/testdir/test22.in b/src/nvim/testdir/test22.in deleted file mode 100644 index f5cc046c6a..0000000000 --- a/src/nvim/testdir/test22.in +++ /dev/null @@ -1,13 +0,0 @@ -Tests for file with some lines ending in CTRL-M, some not
-
-STARTTEST -:set ta tx -:e! -:$-3,$w! test.out -:qa! -ENDTEST - -this lines ends in a
-this one doesn't -this one does
-and the last one doesn't diff --git a/src/nvim/testdir/test22.ok b/src/nvim/testdir/test22.ok deleted file mode 100644 index 38ff89eaf3..0000000000 --- a/src/nvim/testdir/test22.ok +++ /dev/null @@ -1,4 +0,0 @@ -this lines ends in a
-this one doesn't -this one does
-and the last one doesn't diff --git a/src/nvim/testdir/test23.in b/src/nvim/testdir/test23.in deleted file mode 100644 index 0e0e605531..0000000000 --- a/src/nvim/testdir/test23.in +++ /dev/null @@ -1,15 +0,0 @@ -Tests for complicated + argument to :edit command - -STARTTEST -:$-1w! Xfile1 -:$w! Xfile2 -:edit +1|s/|/PIPE/|w Xfile1| e Xfile2|1 | s/\//SLASH/|w -:w! test.out -:e Xfile1 -:w >> test.out -:qa! -ENDTEST - -The result should be in Xfile1: "fooPIPEbar", in Xfile2: "fooSLASHbar" -foo|bar -foo/bar diff --git a/src/nvim/testdir/test23.ok b/src/nvim/testdir/test23.ok deleted file mode 100644 index f1930abad6..0000000000 --- a/src/nvim/testdir/test23.ok +++ /dev/null @@ -1,2 +0,0 @@ -fooSLASHbar -fooPIPEbar diff --git a/src/nvim/testdir/test27.in b/src/nvim/testdir/test27.in deleted file mode 100644 index 2df16d9eff..0000000000 --- a/src/nvim/testdir/test27.in +++ /dev/null @@ -1,20 +0,0 @@ -Test for expanding file names - -STARTTEST -:!mkdir Xdir1 -:!mkdir Xdir2 -:!mkdir Xdir3 -:cd Xdir3 -:!mkdir Xdir4 -:cd .. -:w Xdir1/file -:w Xdir3/Xdir4/file -:n Xdir?/*/file -Go%:.w! test.out -:n! Xdir?/*/nofile -Go%:.w >>test.out -:e! xx -:!rm -rf Xdir1 Xdir2 Xdir3 -:qa! -ENDTEST - diff --git a/src/nvim/testdir/test27.ok b/src/nvim/testdir/test27.ok deleted file mode 100644 index c35f2438a9..0000000000 --- a/src/nvim/testdir/test27.ok +++ /dev/null @@ -1,2 +0,0 @@ -Xdir3/Xdir4/file -Xdir?/*/nofile diff --git a/src/nvim/testdir/test28.in b/src/nvim/testdir/test28.in Binary files differdeleted file mode 100644 index 5542c92666..0000000000 --- a/src/nvim/testdir/test28.in +++ /dev/null diff --git a/src/nvim/testdir/test28.ok b/src/nvim/testdir/test28.ok deleted file mode 100644 index 911d854655..0000000000 --- a/src/nvim/testdir/test28.ok +++ /dev/null @@ -1,2 +0,0 @@ -sd -map __2 asdsecondsdsd0map __5 asd0fifth diff --git a/src/nvim/testdir/test4.in b/src/nvim/testdir/test4.in deleted file mode 100644 index 4aa2fe5a86..0000000000 --- a/src/nvim/testdir/test4.in +++ /dev/null @@ -1,31 +0,0 @@ -Test for autocommand that changes current buffer on BufEnter event. -Check if modelines are interpreted for the correct buffer. - -STARTTEST -:so small.vim -:set nocompatible viminfo+=nviminfo -:au BufEnter Xxx brew -/start of -:.,/end of/w! Xxx " write test file Xxx -:set ai modeline modelines=3 -:sp Xxx " split to Xxx, autocmd will do :brew -G?this is a -othis should be auto-indented -: " Append text with autoindent to this file -:au! BufEnter Xxx -:buf Xxx " go to Xxx, no autocmd anymore -G?this is a -othis should be in column 1:wq " append text without autoindent to Xxx -G:r Xxx " include Xxx in the current file -:?startstart?,$w! test.out -:qa! -ENDTEST - -startstart -start of test file Xxx -vim: set noai : - this is a test - this is a test - this is a test - this is a test -end of test file Xxx diff --git a/src/nvim/testdir/test4.ok b/src/nvim/testdir/test4.ok deleted file mode 100644 index dffecda4d2..0000000000 --- a/src/nvim/testdir/test4.ok +++ /dev/null @@ -1,17 +0,0 @@ -startstart -start of test file Xxx -vim: set noai : - this is a test - this is a test - this is a test - this is a test - this should be auto-indented -end of test file Xxx -start of test file Xxx -vim: set noai : - this is a test - this is a test - this is a test - this is a test -this should be in column 1 -end of test file Xxx diff --git a/src/nvim/testdir/test41.in b/src/nvim/testdir/test41.in deleted file mode 100644 index 2d294cae09..0000000000 --- a/src/nvim/testdir/test41.in +++ /dev/null @@ -1,24 +0,0 @@ -Test for writing and reading a file of over 100 Kbyte - -1 line: "This is the start" -3001 lines: "This is the leader" -1 line: "This is the middle" -3001 lines: "This is the trailer" -1 line: "This is the end" - -STARTTEST -:%d -aThis is the start -This is the leader -This is the middle -This is the trailer -This is the endkY3000p2GY3000p -:w! Xtest -:%d -:e! Xtest -:.w! test.out -3003G:.w >>test.out -6005G:.w >>test.out -:qa! -ENDTEST - diff --git a/src/nvim/testdir/test41.ok b/src/nvim/testdir/test41.ok deleted file mode 100644 index 988e5f24b4..0000000000 --- a/src/nvim/testdir/test41.ok +++ /dev/null @@ -1,3 +0,0 @@ -This is the start -This is the middle -This is the end diff --git a/src/nvim/testdir/test46.in b/src/nvim/testdir/test46.in deleted file mode 100644 index 9a9db74d62..0000000000 --- a/src/nvim/testdir/test46.in +++ /dev/null @@ -1,27 +0,0 @@ -Tests for multi-line regexps with ":s". vim: set ft=vim : - -STARTTEST -:" test if replacing a line break works with a back reference -:/^1/,/^2/s/\n\(.\)/ \1/ -:" test if inserting a line break works with a back reference -:/^3/,/^4/s/\(.\)$/\r\1/ -:" test if replacing a line break with another line break works -:/^5/,/^6/s/\(\_d\{3}\)/x\1x/ -:/^1/,$w! test.out -:qa! -ENDTEST - -1 aa -bb -cc -2 dd -ee -3 ef -gh -4 ij -5 a8 -8b c9 -9d -6 e7 -77f -xxxxx diff --git a/src/nvim/testdir/test46.ok b/src/nvim/testdir/test46.ok deleted file mode 100644 index 71b353df1d..0000000000 --- a/src/nvim/testdir/test46.ok +++ /dev/null @@ -1,13 +0,0 @@ -1 aa bb cc 2 dd ee -3 e -f -g -h -4 i -j -5 ax8 -8xb cx9 -9xd -6 ex7 -7x7f -xxxxx diff --git a/src/nvim/testdir/test54.in b/src/nvim/testdir/test54.in deleted file mode 100644 index 9fc6537e08..0000000000 --- a/src/nvim/testdir/test54.in +++ /dev/null @@ -1,22 +0,0 @@ -Some tests for buffer-local autocommands - -STARTTEST -:so small.vim -:e xx -:if has("vms") -: !del test.out.* -: au BufLeave <buffer> :!write sys$output "buffer-local autommand in %" > test.out -:else -: !rm -f test.out -: au BufLeave <buffer> :!echo buffer-local autommand in %>> test.out -:endif -:e somefile " here, autocommand for xx shall write test.out -: " but autocommand shall not apply to buffer named <buffer> -:bwipe xx " here, autocommand shall be auto-deleted -:e xx " nothing shall be written -:e somefile " nothing shall be written -:qa! -ENDTEST - -start of test file xx -end of test file xx diff --git a/src/nvim/testdir/test54.ok b/src/nvim/testdir/test54.ok deleted file mode 100644 index 0fd1dc915b..0000000000 --- a/src/nvim/testdir/test54.ok +++ /dev/null @@ -1 +0,0 @@ -buffer-local autommand in xx diff --git a/src/nvim/testdir/test56.in b/src/nvim/testdir/test56.in deleted file mode 100644 index 311a6004ca..0000000000 --- a/src/nvim/testdir/test56.in +++ /dev/null @@ -1,21 +0,0 @@ -Test for script-local function. vim: set ft=vim : - -STARTTEST -:so small.vim -:" -:set nocp viminfo+=nviminfo -:/^start:/+1,/^end:/-1w! Xtest.vim -:source Xtest.vim -_x -:$-1,$wq! test.out -ENDTEST - -start: -fun <SID>DoLast() - call append(line('$'), "last line") -endfun -fun s:DoNothing() - call append(line('$'), "nothing line") -endfun -nnoremap <buffer> _x :call <SID>DoNothing()<bar>call <SID>DoLast()<bar>delfunc <SID>DoNothing<bar>delfunc <SID>DoLast<cr> -end: diff --git a/src/nvim/testdir/test56.ok b/src/nvim/testdir/test56.ok deleted file mode 100644 index f2b0d33c8b..0000000000 --- a/src/nvim/testdir/test56.ok +++ /dev/null @@ -1,2 +0,0 @@ -nothing line -last line diff --git a/src/nvim/testdir/test6.in b/src/nvim/testdir/test6.in deleted file mode 100644 index 1ebbe2fa51..0000000000 --- a/src/nvim/testdir/test6.in +++ /dev/null @@ -1,24 +0,0 @@ -Test for autocommand that redefines the argument list, when doing ":all". - -STARTTEST -:so small.vim -:au BufReadPost Xxx2 next Xxx2 Xxx1 -/^start of -A1:.,/end of/w! Xxx1 " write test file Xxx1 -$r2:.,/end of/w! Xxx2 " write test file Xxx2 -$r3:.,/end of/w! Xxx3 " write test file Xxx3 -:next! Xxx1 Xxx2 Xxx3 " redefine arglist; go to Xxx1 -:all " open window for all args -:w! test.out " Write contents of Xxx1 -:w >>test.out " Append contents of last window (Xxx1) -:rew " should now be in Xxx2 -:w >>test.out " Append contents of Xxx2 -:qa! -ENDTEST - -start of test file Xxx - this is a test - this is a test - this is a test - this is a test -end of test file Xxx diff --git a/src/nvim/testdir/test6.ok b/src/nvim/testdir/test6.ok deleted file mode 100644 index b6b0c93e4e..0000000000 --- a/src/nvim/testdir/test6.ok +++ /dev/null @@ -1,18 +0,0 @@ -start of test file Xxx1 - this is a test - this is a test - this is a test - this is a test -end of test file Xxx -start of test file Xxx1 - this is a test - this is a test - this is a test - this is a test -end of test file Xxx -start of test file Xxx2 - this is a test - this is a test - this is a test - this is a test -end of test file Xxx diff --git a/src/nvim/testdir/test7.in b/src/nvim/testdir/test7.in deleted file mode 100644 index b9cc0585f6..0000000000 --- a/src/nvim/testdir/test7.in +++ /dev/null @@ -1,26 +0,0 @@ -Test for autocommand that changes the buffer list, when doing ":ball". - -STARTTEST -:so small.vim -/^start of -A1:.,/end of/w! Xxx1 " write test file Xxx1 -:sp Xxx1 -:close -$r2:.,/end of/w! Xxx2 " write test file Xxx2 -:sp Xxx2 -:close -$r3:.,/end of/w! Xxx3 " write test file Xxx3 -:sp Xxx3 -:close -:au BufReadPost Xxx2 bwipe -$r4:ball " open window for all args, close Xxx2 -:.,$w! test.out " Write contents of this file -:w >>test.out " Append contents of second window (Xxx1) -:/^start of/,$w >>test.out " Append contents of last window (this file) -:qa! -ENDTEST - -start of test file Xxx - this is a test - this is a test -end of test file Xxx diff --git a/src/nvim/testdir/test7.ok b/src/nvim/testdir/test7.ok deleted file mode 100644 index a0d1ff94a3..0000000000 --- a/src/nvim/testdir/test7.ok +++ /dev/null @@ -1,12 +0,0 @@ -start of test file Xxx4 - this is a test - this is a test -end of test file Xxx -start of test file Xxx1 - this is a test - this is a test -end of test file Xxx -start of test file Xxx4 - this is a test - this is a test -end of test file Xxx diff --git a/src/nvim/testdir/test81.in b/src/nvim/testdir/test81.in deleted file mode 100644 index 82a6892a1d..0000000000 --- a/src/nvim/testdir/test81.in +++ /dev/null @@ -1,22 +0,0 @@ -Test for t movement command and 'cpo-;' setting - -STARTTEST -:set nocompatible viminfo+=nviminfo -:set cpo-=; -/firstline/ -j0tt;D -0fz;D -$Fy;D -$Ty;D:set cpo+=; -j0tt;;D -$Ty;;D:?firstline?+1,$w! test.out -:qa! -ENDTEST - -firstline -aaa two three four - zzz -yyy -bbb yee yoo four -ccc two three four -ddd yee yoo four diff --git a/src/nvim/testdir/test81.ok b/src/nvim/testdir/test81.ok deleted file mode 100644 index e9f17dc4f8..0000000000 --- a/src/nvim/testdir/test81.ok +++ /dev/null @@ -1,6 +0,0 @@ -aaa two - z -y -bbb y -ccc -ddd yee y diff --git a/src/nvim/testdir/test9.in b/src/nvim/testdir/test9.in deleted file mode 100644 index 84e17943c7..0000000000 --- a/src/nvim/testdir/test9.in +++ /dev/null @@ -1,12 +0,0 @@ -Test for Bufleave autocommand that deletes the buffer we are about to edit. - -STARTTEST -:so small.vim -:au BufLeave test9.in bwipe yy -:e yy -:/^start of/,$w! test.out " Write contents of this file -:qa! -ENDTEST - -start of test file xx -end of test file xx diff --git a/src/nvim/testdir/test9.ok b/src/nvim/testdir/test9.ok deleted file mode 100644 index cccb5f3ef2..0000000000 --- a/src/nvim/testdir/test9.ok +++ /dev/null @@ -1,2 +0,0 @@ -start of test file xx -end of test file xx diff --git a/src/nvim/testdir/test97.in b/src/nvim/testdir/test97.in deleted file mode 100644 index d4ff6d9295..0000000000 --- a/src/nvim/testdir/test97.in +++ /dev/null @@ -1,23 +0,0 @@ -Test whether glob()/globpath() return correct results with certain escaped -characters. - -STARTTEST -:so small.vim -:" make sure glob() doesn't use the shell -:set shell=doesnotexist -:" consistent sorting of file names -:set nofileignorecase -:e test.out -:$put =glob('Xxx\{') -:$put =glob('Xxx\$') -:w! Xxx{ -:w! Xxx\$ -:$put =glob('Xxx\{') -:$put =glob('Xxx\$') -:" -:$put =string(globpath('sautest/autoload', '*.vim')) -:$put =string(globpath('sautest/autoload', '*.vim', 0, 1)) -:w -:qa! -ENDTEST - diff --git a/src/nvim/testdir/test97.ok b/src/nvim/testdir/test97.ok deleted file mode 100644 index 32cdcbf1be..0000000000 --- a/src/nvim/testdir/test97.ok +++ /dev/null @@ -1,8 +0,0 @@ - - - -Xxx{ -Xxx$ -'sautest/autoload/Test104.vim -sautest/autoload/footest.vim' -['sautest/autoload/Test104.vim', 'sautest/autoload/footest.vim'] diff --git a/src/nvim/testdir/test_autoformat_join.in b/src/nvim/testdir/test_autoformat_join.in deleted file mode 100644 index f1e1c868d3..0000000000 --- a/src/nvim/testdir/test_autoformat_join.in +++ /dev/null @@ -1,23 +0,0 @@ -Tests for setting the '[,'] marks when joining lines. - -STARTTEST -:so small.vim -:/^\t\t/ -0gqj -:let a=string(getpos("'[")).'/'.string(getpos("']")) -:/^This line/;'}-join -:let b=string(getpos("'[")).'/'.string(getpos("']")) -:$put ='First test: Start/End '.string(a) -:$put ='Second test: Start/End '.string(b) -:/^\t\t/,$wq! test.out -ENDTEST - - - O sodales, ludite, vos qui -attamen consulite per voster honur. Tua pulchra facies me fay planszer milies - -This line. -Should be joined with the next line -and with this line - -Results: diff --git a/src/nvim/testdir/test_autoformat_join.ok b/src/nvim/testdir/test_autoformat_join.ok deleted file mode 100644 index 3b1df79514..0000000000 --- a/src/nvim/testdir/test_autoformat_join.ok +++ /dev/null @@ -1,8 +0,0 @@ - O sodales, ludite, vos qui attamen consulite per voster honur. -Tua pulchra facies me fay planszer milies - -This line. Should be joined with the next line and with this line - -Results: -First test: Start/End '[0, 16, 1, 0]/[0, 17, 1, 0]' -Second test: Start/End '[0, 19, 11, 0]/[0, 19, 67, 0]' diff --git a/src/nvim/testdir/test_changelist.in b/src/nvim/testdir/test_changelist.in deleted file mode 100644 index 6c7c4306c3..0000000000 --- a/src/nvim/testdir/test_changelist.in +++ /dev/null @@ -1,22 +0,0 @@ -Test changelist position after splitting window -Set 'undolevels' to make changelist for sourced file - -STARTTEST -:so small.vim -Gkylp:set ul=100 -Gylp:set ul=100 -gg -:vsplit -:try -: normal g; -: normal ggVGcpass -:catch -: normal ggVGcfail -:finally -: %w! test.out -:endtry -:qa! -ENDTEST - -1 -2 diff --git a/src/nvim/testdir/test_changelist.ok b/src/nvim/testdir/test_changelist.ok deleted file mode 100644 index 2ae28399f5..0000000000 --- a/src/nvim/testdir/test_changelist.ok +++ /dev/null @@ -1 +0,0 @@ -pass diff --git a/src/nvim/testdir/test_insertcount.in b/src/nvim/testdir/test_insertcount.in deleted file mode 100644 index 7a40573e63..0000000000 --- a/src/nvim/testdir/test_insertcount.in +++ /dev/null @@ -1,14 +0,0 @@ -Tests for repeating insert and replace. - -STARTTEST -:so small.vim -:/Second -4gro -:/^First/,$wq! test.out -:" get here when failed and in Insert mode -:.wq! test.out -ENDTEST - -First line -Second line -Last line diff --git a/src/nvim/testdir/test_insertcount.ok b/src/nvim/testdir/test_insertcount.ok deleted file mode 100644 index 57afab00ff..0000000000 --- a/src/nvim/testdir/test_insertcount.ok +++ /dev/null @@ -1,3 +0,0 @@ -First line -ooooecond line -Last line diff --git a/src/nvim/testdir/test_options.in b/src/nvim/testdir/test_options.in deleted file mode 100644 index bf1232a223..0000000000 --- a/src/nvim/testdir/test_options.in +++ /dev/null @@ -1,17 +0,0 @@ -Test for ":options". - -STARTTEST -:so small.vim -:let caught = 'ok' -:try - :options -:catch - :let caught = v:throwpoint . "\n" . v:exception -:endtry -:buf 1 -:$put =caught -:/^result/,$w! test.out -:qa! -ENDTEST - -result diff --git a/src/nvim/testdir/test_options.ok b/src/nvim/testdir/test_options.ok deleted file mode 100644 index a2e1494a1f..0000000000 --- a/src/nvim/testdir/test_options.ok +++ /dev/null @@ -1,2 +0,0 @@ -result -ok diff --git a/src/nvim/testdir/test_utf8.in b/src/nvim/testdir/test_utf8.in deleted file mode 100644 index e8d23c4be8..0000000000 --- a/src/nvim/testdir/test_utf8.in +++ /dev/null @@ -1,18 +0,0 @@ -Tests for Unicode manipulations - -STARTTEST -:so small.vim -:set encoding=utf-8 -:" Visual block Insert adjusts for multi-byte char -:new -:call setline(1, ["aaa", "あああ", "bbb"]) -:exe ":norm! gg0l\<C-V>jjIx\<Esc>" -:let r = getline(1, '$') -: -:bwipeout! -:$put=r -:call garbagecollect(1) -:/^start:/,$wq! test.out -ENDTEST - -start: diff --git a/src/nvim/testdir/test_utf8.ok b/src/nvim/testdir/test_utf8.ok deleted file mode 100644 index c5bed54856..0000000000 --- a/src/nvim/testdir/test_utf8.ok +++ /dev/null @@ -1,4 +0,0 @@ -start: -axaa -xあああ -bxbb diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua index d9107543ea..70f4fcf9e5 100644 --- a/test/functional/helpers.lua +++ b/test/functional/helpers.lua @@ -67,6 +67,25 @@ local function restart() mapclear! abclear comclear + let regs = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789/-"' + let i = 0 + while i < strlen(regs) + call setreg(regs[i], '') + let i = i+1 + endwhile + redir => funcs + silent! function + redir END + for fname in split(funcs, '\n') + let matches = matchlist(fname, '\v^function ([^()<>]+)') + if type([]) == type(matches) && matches[1] !~ 'BeforeEachTest' + exe 'silent! delfunc '.matches[1] + endif + endfor + let options = ['shell', 'fileignorecase'] + for option in options + exe 'set '.option.'&' + endfor endfunction ]]) end @@ -83,6 +102,9 @@ local function request(method, ...) error(rv[2]) end end + -- Make sure this will only return after all buffered characters have been + -- processed + session:request('vim_eval', '1') return rv end @@ -201,7 +223,6 @@ local function expect(contents, first, last, buffer_index) return eq(dedent(contents), buffer_slice(first, last, buffer_index)) end - local function ok(expr) assert.is_true(expr) end @@ -254,6 +275,7 @@ restart() return { clear = clear, + dedent = dedent, restart = restart, rawfeed = rawfeed, insert = insert, diff --git a/test/functional/legacy/004_bufenter_with_modelines_spec.lua b/test/functional/legacy/004_bufenter_with_modelines_spec.lua new file mode 100644 index 0000000000..f1222700a7 --- /dev/null +++ b/test/functional/legacy/004_bufenter_with_modelines_spec.lua @@ -0,0 +1,72 @@ +-- vim: set foldmethod=marker foldmarker=[[,]] : +-- Test for autocommand that changes current buffer on BufEnter event. +-- Check if modelines are interpreted for the correct buffer. + +local helpers = require('test.functional.helpers') +local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert +local execute, expect = helpers.execute, helpers.expect + +describe('BufEnter with modelines', function() + setup(clear) + + it('is working', function() + insert([[ + startstart + start of test file Xxx + vim: set noai : + this is a test + this is a test + this is a test + this is a test + end of test file Xxx]]) + + execute('au BufEnter Xxx brew') + + -- Write test file Xxx + execute('/start of') + execute('.,/end of/w! Xxx') + execute('set ai modeline modelines=3') + + -- Split to Xxx, autocmd will do :brew + execute('sp Xxx') + + -- Append text with autoindent to this file + feed('G?this is a<Esc>') + feed('othis should be auto-indented<Esc>') + + -- Go to Xxx, no autocmd anymore + execute('au! BufEnter Xxx') + execute('buf Xxx') + + -- Append text without autoindent to Xxx + feed('G?this is a<Esc>') + feed('othis should be in column 1<Esc>') + execute('wq') + + -- Include Xxx in the current file + feed('G:r Xxx<CR>') + + expect([[ + startstart + start of test file Xxx + vim: set noai : + this is a test + this is a test + this is a test + this is a test + this should be auto-indented + end of test file Xxx + start of test file Xxx + vim: set noai : + this is a test + this is a test + this is a test + this is a test + this should be in column 1 + end of test file Xxx]]) + end) + + teardown(function() + os.remove('Xxx') + end) +end) diff --git a/test/functional/legacy/006_argument_list_spec.lua b/test/functional/legacy/006_argument_list_spec.lua new file mode 100644 index 0000000000..30fb9a55ff --- /dev/null +++ b/test/functional/legacy/006_argument_list_spec.lua @@ -0,0 +1,81 @@ +-- Test for autocommand that redefines the argument list, when doing ":all". + +local helpers = require('test.functional.helpers') +local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert +local execute, dedent, eq = helpers.execute, helpers.dedent, helpers.eq +local curbuf_contents = helpers.curbuf_contents + +describe('argument list', function() + setup(clear) + + it('is working', function() + insert([[ + start of test file Xxx + this is a test + this is a test + this is a test + this is a test + end of test file Xxx]]) + + execute('au BufReadPost Xxx2 next Xxx2 Xxx1') + execute('/^start of') + + -- Write test file Xxx1 + feed('A1<Esc>:.,/end of/w! Xxx1<cr>') + + -- Write test file Xxx2 + feed('$r2:.,/end of/w! Xxx2<cr>') + + -- Write test file Xxx3 + feed('$r3:.,/end of/w! Xxx3<cr>') + + -- Redefine arglist; go to Xxx1 + execute('next! Xxx1 Xxx2 Xxx3') + + -- Open window for all args + execute('all') + + -- Write contents of Xxx1 + execute('%yank A') + + -- Append contents of last window (Xxx1) + feed('') + execute('%yank A') + + -- should now be in Xxx2 + execute('rew') + + -- Append contents of Xxx2 + execute('%yank A') + + execute('%d') + execute('0put=@a') + execute('1d | $d') + + eq(dedent([[ + start of test file Xxx1 + this is a test + this is a test + this is a test + this is a test + end of test file Xxx + start of test file Xxx1 + this is a test + this is a test + this is a test + this is a test + end of test file Xxx + start of test file Xxx2 + this is a test + this is a test + this is a test + this is a test + end of test file Xxx]]), curbuf_contents()) + end) + + teardown(function() + os.remove('Xxx1') + os.remove('Xxx2') + os.remove('Xxx3') + end) +end) diff --git a/test/functional/legacy/007_ball_buffer_list_spec.lua b/test/functional/legacy/007_ball_buffer_list_spec.lua new file mode 100644 index 0000000000..6d89323215 --- /dev/null +++ b/test/functional/legacy/007_ball_buffer_list_spec.lua @@ -0,0 +1,77 @@ +-- Test for autocommand that changes the buffer list, when doing ":ball". + +local helpers = require('test.functional.helpers') +local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert +local execute, expect = helpers.execute, helpers.expect + +describe(':ball', function() + setup(clear) + + it('is working', function() + insert([[ + start of test file Xxx + this is a test + this is a test + end of test file Xxx]]) + + execute('w! Xxx0') + feed('gg') + + -- Write test file Xxx1 + feed('A1:.,/end of/w! Xxx1<cr>') + execute('sp Xxx1') + execute('close') + + -- Write test file Xxx2 + feed('$r2:.,/end of/w! Xxx2<cr>') + execute('sp Xxx2') + execute('close') + + -- Write test file Xxx3 + feed('$r3:.,/end of/w! Xxx3<cr>') + execute('sp Xxx3') + execute('close') + + execute('au BufReadPost Xxx2 bwipe') + + -- Open window for all args, close Xxx2 + feed('$r4:ball<cr>') + + -- Write contents of this file + execute('%yank A') + + -- Append contents of second window (Xxx1) + feed('') + execute('%yank A') + + -- Append contents of last window (this file) + feed('') + execute('%yank A') + + execute('bf') + execute('%d') + execute('0put=@a') + execute('1d | $d') + + expect([[ + start of test file Xxx4 + this is a test + this is a test + end of test file Xxx + start of test file Xxx1 + this is a test + this is a test + end of test file Xxx + start of test file Xxx4 + this is a test + this is a test + end of test file Xxx]]) + end) + + teardown(function() + os.remove('Xxx0') + os.remove('Xxx1') + os.remove('Xxx2') + os.remove('Xxx3') + end) +end) diff --git a/test/functional/legacy/009_bufleave_autocommand_spec.lua b/test/functional/legacy/009_bufleave_autocommand_spec.lua new file mode 100644 index 0000000000..0fc1b5b657 --- /dev/null +++ b/test/functional/legacy/009_bufleave_autocommand_spec.lua @@ -0,0 +1,22 @@ +-- Test for Bufleave autocommand that deletes the buffer we are about to edit. + +local helpers = require('test.functional.helpers') +local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert +local execute, expect = helpers.execute, helpers.expect + +describe('BufLeave autocommand', function() + setup(clear) + + it('is working', function() + insert([[ + start of test file xx + end of test file xx]]) + + execute('au BufLeave * bwipe yy') + execute('e yy') + + expect([[ + start of test file xx + end of test file xx]]) + end) +end) diff --git a/test/functional/legacy/018_unset_smart_indenting_spec.lua b/test/functional/legacy/018_unset_smart_indenting_spec.lua new file mode 100644 index 0000000000..6975cb7f26 --- /dev/null +++ b/test/functional/legacy/018_unset_smart_indenting_spec.lua @@ -0,0 +1,28 @@ +-- Tests for not doing smart indenting when it isn't set. + +local helpers = require('test.functional.helpers') +local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert +local execute, expect = helpers.execute, helpers.expect + +describe('unset smart indenting', function() + setup(clear) + + it('is working', function() + insert([[ + start text + some test text + test text + test text + test text]]) + + execute('set nocin nosi ai') + execute('/some') + feed('2cc#test<Esc>') + + expect([[ + start text + #test + test text + test text]]) + end) +end) diff --git a/test/functional/legacy/020_blockwise_visual_spec.lua b/test/functional/legacy/020_blockwise_visual_spec.lua new file mode 100644 index 0000000000..95574a0957 --- /dev/null +++ b/test/functional/legacy/020_blockwise_visual_spec.lua @@ -0,0 +1,49 @@ +-- vim: set foldmethod=marker foldmarker=[[,]] : +-- Tests Blockwise Visual when there are TABs before the text. +-- First test for undo working properly when executing commands from a register. +-- Also test this in an empty buffer. + +local helpers = require('test.functional.helpers') +local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert +local execute, expect = helpers.execute, helpers.expect + +describe('blockwise visual', function() + setup(clear) + + it('is working', function() + insert([[ +123456 +234567 +345678 + +test text test tex start here + some text + test text +test text + +x jAy kdd +Ox jAy kdd]]) + + feed(":let @a = 'Ox<C-v><Esc>jAy<C-v><Esc>kdd'<cr>") + feed('G0k@au') + execute('new') + feed('@auY') + execute('quit') + feed('GP') + execute('/start here') + feed('"by$<C-v>jjlld') + execute('/456') + feed('<C-v>jj"bP') + execute('$-3,$d') + + expect([[ +123start here56 +234start here67 +345start here78 + +test text test tex rt here + somext + tesext +test text]]) + end) +end) diff --git a/test/functional/legacy/021_control_wi_spec.lua b/test/functional/legacy/021_control_wi_spec.lua new file mode 100644 index 0000000000..f1f529e9a8 --- /dev/null +++ b/test/functional/legacy/021_control_wi_spec.lua @@ -0,0 +1,41 @@ +-- vim: set foldmethod=marker foldmarker=[[,]] : +-- Tests for [ CTRL-I with a count and CTRL-W CTRL-I with a count + +local helpers = require('test.functional.helpers') +local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert +local execute, expect = helpers.execute, helpers.expect + +describe('CTRL-W CTRL-I', function() + setup(clear) + + it('is working', function() + insert([[ + #include test21.in + + /* test text test tex start here + some text + test text + start OK if found this line + start found wrong line + test text]]) + + -- Search for the second occurence of start and append to register + execute('/start') + feed('2[<C-i>') + execute('yank A') + + -- Same as above but using different keystrokes. + feed('?start<cr>') + feed('2<C-w><Tab>') + execute('yank A') + + -- Clean buffer and put register + feed('ggdG"ap') + execute('1,2d') + + -- The buffer should now contain: + expect([[ + start OK if found this line + start OK if found this line]]) + end) +end) diff --git a/test/functional/legacy/022_line_ending_spec.lua b/test/functional/legacy/022_line_ending_spec.lua new file mode 100644 index 0000000000..4b897a7c95 --- /dev/null +++ b/test/functional/legacy/022_line_ending_spec.lua @@ -0,0 +1,25 @@ +-- Tests for file with some lines ending in CTRL-M, some not + +local helpers = require('test.functional.helpers') +local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert +local execute, expect = helpers.execute, helpers.expect + +describe('line ending', function() + setup(clear) + + it('is working', function() + feed('i', [[ + this lines ends in a<C-V><C-M> + this one doesn't + this one does<C-V><C-M> + and the last one doesn't]], '<ESC>') + + execute('set ta tx') + execute('e!') + + expect("this lines ends in a\r\n".. + "this one doesn't\n".. + "this one does\r\n".. + "and the last one doesn't") + end) +end) diff --git a/test/functional/legacy/023_edit_arguments_spec.lua b/test/functional/legacy/023_edit_arguments_spec.lua new file mode 100644 index 0000000000..b5955c5987 --- /dev/null +++ b/test/functional/legacy/023_edit_arguments_spec.lua @@ -0,0 +1,52 @@ +-- Tests for complicated + argument to :edit command + +local helpers = require('test.functional.helpers') +local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert +local execute, expect = helpers.execute, helpers.expect + +describe(':edit', function() + setup(clear) + + it('is working', function() + insert([[ + The result should be in Xfile1: "fooPIPEbar", in Xfile2: "fooSLASHbar" + foo|bar + foo/bar]]) + + -- Prepare some test files + execute('$-1w! Xfile1') + execute('$w! Xfile2') + execute('w! Xfile0') + + -- Open Xfile using '+' range + execute('edit +1 Xfile1') + execute('s/|/PIPE/') + execute('yank A') + execute('w! Xfile1') + + -- Open Xfile2 using '|' range + execute('edit Xfile2|1') + execute("s/\\//SLASH/") + execute('yank A') + execute('w! Xfile2') + + -- Clean first buffer and put @a + execute('bf') + execute('%d') + execute('0put a') + + -- Remove empty lines + execute('1d | $d') + + -- The buffer should now contain + expect([[ + fooPIPEbar + fooSLASHbar]]) + end) + + teardown(function() + os.remove('Xfile0') + os.remove('Xfile1') + os.remove('Xfile2') + end) +end) diff --git a/test/functional/legacy/027_expand_file_names_spec.lua b/test/functional/legacy/027_expand_file_names_spec.lua new file mode 100644 index 0000000000..bff61c1516 --- /dev/null +++ b/test/functional/legacy/027_expand_file_names_spec.lua @@ -0,0 +1,38 @@ +-- Test for expanding file names + +local helpers = require('test.functional.helpers') +local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert +local execute, expect = helpers.execute, helpers.expect +local curbuf_contents = helpers.curbuf_contents +local eq, eval = helpers.eq, helpers.eval + +describe('expand file name', function() + setup(clear) + + it('is working', function() + execute('set nocp') + execute('!mkdir Xdir1') + execute('!mkdir Xdir2') + execute('!mkdir Xdir3') + execute('cd Xdir3') + execute('!mkdir Xdir4') + execute('cd ..') + execute('w Xdir1/file') + execute('w Xdir3/Xdir4/file') + execute('n Xdir?/*/file') + + -- Yank current file path to @a register + feed('i<C-R>%<Esc>V"ad') + + -- Put @a and current file path in the current buffer + execute('n! Xdir?/*/nofile') + feed('V"ap') + feed('o<C-R>%<Esc>') + + eq("Xdir3/Xdir4/file\nXdir?/*/nofile", curbuf_contents()) + end) + + teardown(function() + os.execute('rm -rf Xdir1 Xdir2 Xdir3') + end) +end) diff --git a/test/functional/legacy/028_source_ctrl_v_spec.lua b/test/functional/legacy/028_source_ctrl_v_spec.lua new file mode 100644 index 0000000000..fc36b436ef --- /dev/null +++ b/test/functional/legacy/028_source_ctrl_v_spec.lua @@ -0,0 +1,40 @@ +-- Test for sourcing a file with CTRL-V's at the end of the line + +local helpers = require('test.functional.helpers') +local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert +local execute, expect = helpers.execute, helpers.expect + +describe('CTRL-V at the end of the line', function() + setup(clear) + + it('is working', function() + insert([[ + firstline + map __1 afirst + map __2 asecond + map __3 athird + map __4 afourth + map __5 afifth + map __1 asdX + map __2 asdXX + map __3 asdXX + map __4 asdXXX + map __5 asdXXX + lastline]]) + + feed(':%s/X/<C-v><C-v>/g<cr>') + feed(':/firstline/+1,/lastline/-1w! Xtestfile<cr>') + execute('so Xtestfile') + execute('%d') + feed('Gmm__1<Esc><Esc>__2<Esc>__3<Esc><Esc>__4<Esc>__5<Esc>') + feed(":'m,$s/<C-v><C-@>/0/g<cr>") + + expect([[ + sd + map __2 asdsecondsdsd0map __5 asd0fifth]]) + end) + + teardown(function() + os.remove('Xtestfile') + end) +end) diff --git a/test/functional/legacy/041_writing_and_reading_hundred_kbyte_spec.lua b/test/functional/legacy/041_writing_and_reading_hundred_kbyte_spec.lua new file mode 100644 index 0000000000..ed1a914c0f --- /dev/null +++ b/test/functional/legacy/041_writing_and_reading_hundred_kbyte_spec.lua @@ -0,0 +1,40 @@ +-- Test for writing and reading a file of over 100 Kbyte + +local helpers = require('test.functional.helpers') +local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert +local execute, expect = helpers.execute, helpers.expect + +describe('writing and reading a file of over 100 Kbyte', function() + setup(clear) + + it('is working', function() + insert([[ + This is the start + This is the leader + This is the middle + This is the trailer + This is the end]]) + + feed('kY3000p2GY3000p') + + execute('w! test.out') + execute('%d') + execute('e! test.out') + execute('yank A') + execute('3003yank A') + execute('6005yank A') + execute('%d') + execute('0put a') + execute('1d | $d') + execute('w!') + + expect([[ + This is the start + This is the middle + This is the end]]) + end) + + teardown(function() + os.remove('test.out') + end) +end) diff --git a/test/functional/legacy/046_multi_line_regexps_spec.lua b/test/functional/legacy/046_multi_line_regexps_spec.lua new file mode 100644 index 0000000000..f8a6143b18 --- /dev/null +++ b/test/functional/legacy/046_multi_line_regexps_spec.lua @@ -0,0 +1,52 @@ +-- vim: set foldmethod=marker foldmarker=[[,]] : +-- Tests for multi-line regexps with ":s" + +local helpers = require('test.functional.helpers') +local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert +local execute, expect = helpers.execute, helpers.expect + +describe('multi-line regexp', function() + setup(clear) + + it('is working', function() + insert([[ + 1 aa + bb + cc + 2 dd + ee + 3 ef + gh + 4 ij + 5 a8 + 8b c9 + 9d + 6 e7 + 77f + xxxxx]]) + + -- Test if replacing a line break works with a back reference + feed([[:/^1/,/^2/s/\n\(.\)/ \1/<cr>]]) + + -- Test if inserting a line break works with a back reference + feed([[:/^3/,/^4/s/\(.\)$/\r\1/<cr>]]) + + -- Test if replacing a line break with another line break works + feed([[:/^5/,/^6/s/\(\_d\{3}\)/x\1x/<cr>]]) + + expect([[ + 1 aa bb cc 2 dd ee + 3 e + f + g + h + 4 i + j + 5 ax8 + 8xb cx9 + 9xd + 6 ex7 + 7x7f + xxxxx]]) + end) +end) diff --git a/test/functional/legacy/054_buffer_local_autocommands_spec.lua b/test/functional/legacy/054_buffer_local_autocommands_spec.lua new file mode 100644 index 0000000000..bcedb26b7e --- /dev/null +++ b/test/functional/legacy/054_buffer_local_autocommands_spec.lua @@ -0,0 +1,33 @@ +-- Some tests for buffer-local autocommands + +local helpers = require('test.functional.helpers') +local clear, execute, eq = helpers.clear, helpers.execute, helpers.eq +local curbuf_contents = helpers.curbuf_contents + +describe('BufLeave <buffer>', function() + setup(clear) + + it('is working', function() + execute('w! xx') + execute('au BufLeave <buffer> norm Ibuffer-local autocommand') + execute('au BufLeave <buffer> update') + + -- Here, autocommand for xx shall append a line + -- But autocommand shall not apply to buffer named <buffer> + execute('e somefile') + + -- Here, autocommand shall be auto-deleted + execute('bwipe xx') + + -- Nothing shall be written + execute('e xx') + execute('e somefile') + execute('e xx') + + eq('buffer-local autocommand', curbuf_contents()) + end) + + teardown(function() + os.remove('xx') + end) +end) diff --git a/test/functional/legacy/056_script_local_function_spec.lua b/test/functional/legacy/056_script_local_function_spec.lua new file mode 100644 index 0000000000..147391ceb1 --- /dev/null +++ b/test/functional/legacy/056_script_local_function_spec.lua @@ -0,0 +1,31 @@ +-- vim: set foldmethod=marker foldmarker=[[,]] : +-- Test for script-local function. + +local helpers = require('test.functional.helpers') +local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert +local execute, expect = helpers.execute, helpers.expect + +describe('source function', function() + setup(clear) + + it('is working', function() + insert([[ + fun DoLast() + call append(line('$'), "last line") + endfun + fun DoNothing() + call append(line('$'), "nothing line") + endfun + nnoremap <buffer> _x :call DoNothing()<bar>call DoLast()<cr>]]) + + feed(':<C-R>=getline(1,3)<cr><cr>') + feed(':<C-R>=getline(4,6)<cr><cr>') + feed(':<C-R>=getline(7)<cr><cr>') + feed('ggdG') + feed('_xggdd') + + expect([[ + nothing line + last line]]) + end) +end) diff --git a/test/functional/legacy/081_coptions_movement_spec.lua b/test/functional/legacy/081_coptions_movement_spec.lua new file mode 100644 index 0000000000..f27667b976 --- /dev/null +++ b/test/functional/legacy/081_coptions_movement_spec.lua @@ -0,0 +1,39 @@ +-- Test for t movement command and 'cpo-;' setting + +local helpers = require('test.functional.helpers') +local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert +local execute, expect = helpers.execute, helpers.expect + +describe('coptions', function() + setup(clear) + + it('is working', function() + insert([[ + aaa two three four + zzz + yyy + bbb yee yoo four + ccc two three four + ddd yee yoo four]]) + + execute('set cpo-=;') + + feed('gg0tt;D') + feed('j0fz;D') + feed('j$Fy;D') + feed('j$Ty;D') + + execute('set cpo+=;') + + feed('j0tt;;D') + feed('j$Ty;;D') + + expect([[ + aaa two + z + y + bbb y + ccc + ddd yee y]]) + end) +end) diff --git a/test/functional/legacy/097_glob_path_spec.lua b/test/functional/legacy/097_glob_path_spec.lua new file mode 100644 index 0000000000..84f26478ac --- /dev/null +++ b/test/functional/legacy/097_glob_path_spec.lua @@ -0,0 +1,50 @@ +-- vim: set foldmethod=marker foldmarker=[[,]] : +-- Test whether glob()/globpath() return correct results with certain escaped +-- characters. + +local helpers = require('test.functional.helpers') +local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert +local execute, expect = helpers.execute, helpers.expect + +describe('glob() and globpath()', function() + setup(clear) + + setup(function() + os.execute("mkdir -p sautest/autoload") + os.execute("touch sautest/autoload/Test104.vim") + os.execute("touch sautest/autoload/footest.vim") + end) + + it('is working', function() + -- Make sure glob() doesn't use the shell + execute('set shell=doesnotexist') + + -- Consistent sorting of file names + execute('set nofileignorecase') + + execute([[$put =glob('Xxx\{')]]) + execute([[$put =glob('Xxx\$')]]) + + execute('w! Xxx{') + execute([[w! Xxx\$]]) + execute([[$put =glob('Xxx\{')]]) + execute([[$put =glob('Xxx\$')]]) + + execute("$put =string(globpath('sautest/autoload', '*.vim'))") + execute("$put =string(globpath('sautest/autoload', '*.vim', 0, 1))") + + expect([=[ + + + + Xxx{ + Xxx$ + 'sautest/autoload/Test104.vim + sautest/autoload/footest.vim' + ['sautest/autoload/Test104.vim', 'sautest/autoload/footest.vim']]=]) + end) + + teardown(function() + os.execute("rm -rf sautest Xxx{ Xxx$") + end) +end) diff --git a/test/functional/legacy/102_fnameescape_spec.lua b/test/functional/legacy/102_fnameescape_spec.lua new file mode 100644 index 0000000000..251ce68430 --- /dev/null +++ b/test/functional/legacy/102_fnameescape_spec.lua @@ -0,0 +1,26 @@ +-- Test if fnameescape is correct for special chars like! + +local helpers = require('test.functional.helpers') +local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert +local execute, expect = helpers.execute, helpers.expect + +describe('fnameescape', function() + setup(clear) + + it('is working', function() + execute('let fname = "Xspa ce"') + execute('try', 'exe "w! " . fnameescape(fname)', "put='Space'", 'endtry') + execute('let fname = "Xemark!"') + execute('try', 'exe "w! " . fnameescape(fname)', "put='ExclamationMark'", 'endtry') + + expect([[ + + Space + ExclamationMark]]) + end) + + teardown(function() + os.remove("Xspa ce") + os.remove("Xemark!") + end) +end) diff --git a/test/functional/legacy/106_errorformat_spec.lua b/test/functional/legacy/106_errorformat_spec.lua new file mode 100644 index 0000000000..5b6037f928 --- /dev/null +++ b/test/functional/legacy/106_errorformat_spec.lua @@ -0,0 +1,25 @@ +-- Tests for errorformat. + +local helpers = require('test.functional.helpers') +local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert +local execute, expect = helpers.execute, helpers.expect + +describe('errorformat', function() + setup(clear) + + it('is working', function() + execute("set efm=%EEEE%m,%WWWW%m,%+CCCC%.%#,%-GGGG%.%#") + execute("cgetexpr ['WWWW', 'EEEE', 'CCCC']") + execute("$put =strtrans(string(map(getqflist(), '[v:val.text, v:val.valid]')))") + execute("cgetexpr ['WWWW', 'GGGG', 'EEEE', 'CCCC']") + execute("$put =strtrans(string(map(getqflist(), '[v:val.text, v:val.valid]')))") + execute("cgetexpr ['WWWW', 'GGGG', 'ZZZZ', 'EEEE', 'CCCC', 'YYYY']") + execute("$put =strtrans(string(map(getqflist(), '[v:val.text, v:val.valid]')))") + + expect([=[ + + [['W', 1], ['E^@CCCC', 1]] + [['W', 1], ['E^@CCCC', 1]] + [['W', 1], ['ZZZZ', 0], ['E^@CCCC', 1], ['YYYY', 0]]]=]) + end) +end) diff --git a/test/functional/legacy/autoformat_join_spec.lua b/test/functional/legacy/autoformat_join_spec.lua new file mode 100644 index 0000000000..a99cabca24 --- /dev/null +++ b/test/functional/legacy/autoformat_join_spec.lua @@ -0,0 +1,41 @@ +-- vim: set foldmethod=marker foldmarker=[[,]] : +-- Tests for setting the '[,'] marks when joining lines. + +local helpers = require('test.functional.helpers') +local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert +local execute, expect = helpers.execute, helpers.expect + +describe('autoformat join', function() + setup(clear) + + it('is working', function() + insert([[ + O sodales, ludite, vos qui +attamen consulite per voster honur. Tua pulchra facies me fay planszer milies + +This line. +Should be joined with the next line +and with this line + +Results:]]) + + feed('gg') + feed('0gqj<cr>') + + execute([[let a=string(getpos("'[")).'/'.string(getpos("']"))]]) + execute("g/^This line/;'}-join") + execute([[let b=string(getpos("'[")).'/'.string(getpos("']"))]]) + execute("$put ='First test: Start/End '.string(a)") + execute("$put ='Second test: Start/End '.string(b)") + + expect([[ + O sodales, ludite, vos qui attamen consulite per voster honur. +Tua pulchra facies me fay planszer milies + +This line. Should be joined with the next line and with this line + +Results: +First test: Start/End '[0, 1, 1, 0]/[0, 2, 1, 0]' +Second test: Start/End '[0, 4, 11, 0]/[0, 4, 67, 0]']]) + end) +end) diff --git a/test/functional/legacy/changelist_spec.lua b/test/functional/legacy/changelist_spec.lua new file mode 100644 index 0000000000..7c696369d4 --- /dev/null +++ b/test/functional/legacy/changelist_spec.lua @@ -0,0 +1,26 @@ +-- Test changelist position after splitting window +-- Set 'undolevels' to make changelist for sourced file + +local helpers = require('test.functional.helpers') +local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert +local execute, expect = helpers.execute, helpers.expect + +describe('changelist', function() + setup(clear) + + it('is working', function() + insert("1\n2") + + feed('Gkylp') + execute('set ul=100') + + feed('Gylp') + execute('set ul=100') + + feed('gg') + execute('vsplit') + execute('try', 'normal g;', 'normal ggVGcpass', 'catch', 'normal ggVGcfail', 'endtry') + + expect('pass') + end) +end) diff --git a/test/functional/legacy/insertcount_spec.lua b/test/functional/legacy/insertcount_spec.lua new file mode 100644 index 0000000000..01236e1afe --- /dev/null +++ b/test/functional/legacy/insertcount_spec.lua @@ -0,0 +1,24 @@ +-- Tests for repeating insert and replace. + +local helpers = require('test.functional.helpers') +local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert +local execute, expect = helpers.execute, helpers.expect + +describe('insertcount', function() + setup(clear) + + it('is working', function() + insert([[ + First line + Second line + Last line]]) + + execute('/Second') + feed('4gro') + + expect([[ + First line + oooond line + Last line]]) + end) +end) diff --git a/test/functional/legacy/options_spec.lua b/test/functional/legacy/options_spec.lua new file mode 100644 index 0000000000..fcc39434ff --- /dev/null +++ b/test/functional/legacy/options_spec.lua @@ -0,0 +1,20 @@ +-- Test for ":options". + +local helpers = require('test.functional.helpers') +local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert +local execute, expect = helpers.execute, helpers.expect + +describe('options', function() + setup(clear) + + it('is working', function() + insert('result') + + execute("let caught = 'ok'") + execute('try', 'options', 'catch', 'let caught = v:throwpoint . "\n" . v:exception', 'endtry') + execute('buf 1') + execute('$put =caught') + + expect("result\nok") + end) +end) diff --git a/test/functional/legacy/utf8_spec.lua b/test/functional/legacy/utf8_spec.lua new file mode 100644 index 0000000000..d26f436057 --- /dev/null +++ b/test/functional/legacy/utf8_spec.lua @@ -0,0 +1,31 @@ +-- Tests for Unicode manipulations + +local helpers = require('test.functional.helpers') +local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert +local execute, expect = helpers.execute, helpers.expect + +describe('utf8', function() + setup(clear) + + it('is working', function() + insert('start:') + + execute('set encoding=utf-8') + execute('new') + execute('call setline(1, ["aaa", "あああ", "bbb"])') + + -- Visual block Insert adjusts for multi-byte char + feed('gg0l<C-V>jjIx<Esc>') + + execute('let r = getline(1, "$")') + execute('bwipeout!') + execute('$put=r') + execute('call garbagecollect(1)') + + expect([[ + start: + axaa + xあああ + bxbb]]) + end) +end) |