diff options
author | Rainer Borene <rainerborene@gmail.com> | 2015-02-23 12:36:43 -0300 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2015-03-11 00:22:22 -0400 |
commit | 9c40721ea4d7b660b78f519abf96317c70460703 (patch) | |
tree | 6618cb9ee4b6f3dfd78a87c3ee95bb48af2b60b1 | |
parent | 05fcce38968cd32198dafdadf6c1f07bb0d7b550 (diff) | |
download | rneovim-9c40721ea4d7b660b78f519abf96317c70460703.tar.gz rneovim-9c40721ea4d7b660b78f519abf96317c70460703.tar.bz2 rneovim-9c40721ea4d7b660b78f519abf96317c70460703.zip |
legacy tests: migrate test103
-rw-r--r-- | src/nvim/testdir/test103.in | 37 | ||||
-rw-r--r-- | src/nvim/testdir/test103.ok | 2 | ||||
-rw-r--r-- | test/functional/legacy/103_visual_mode_reset.lua | 47 |
3 files changed, 47 insertions, 39 deletions
diff --git a/src/nvim/testdir/test103.in b/src/nvim/testdir/test103.in deleted file mode 100644 index 7c7591e3b9..0000000000 --- a/src/nvim/testdir/test103.in +++ /dev/null @@ -1,37 +0,0 @@ -Test for visual mode not being reset causing E315 error. -STARTTEST -:so small.vim -:enew -:let g:msg="Everything's fine." -:function! TriggerTheProblem() -: " At this point there is no visual selection because :call reset it. -: " Let's restore the selection: -: normal gv -: '<,'>del _ -: try -: exe "normal \<Esc>" -: catch /^Vim\%((\a\+)\)\=:E315/ -: echom 'Snap! E315 error!' -: let g:msg='Snap! E315 error!' -: endtry -:endfunction -:enew -:setl buftype=nofile -:call append(line('$'), 'Delete this line.') -:" -:" -:" NOTE: this has to be done by a call to a function because executing :del the -:" ex-way will require the colon operator which resets the visual mode thus -:" preventing the problem: -:" -GV:call TriggerTheProblem() -:%del _ -:call append(line('$'), g:msg) -:w! test.out -:brewind -ENDTEST - -STARTTEST -:qa! -ENDTEST - diff --git a/src/nvim/testdir/test103.ok b/src/nvim/testdir/test103.ok deleted file mode 100644 index 9ea6dd6eea..0000000000 --- a/src/nvim/testdir/test103.ok +++ /dev/null @@ -1,2 +0,0 @@ - -Everything's fine. diff --git a/test/functional/legacy/103_visual_mode_reset.lua b/test/functional/legacy/103_visual_mode_reset.lua new file mode 100644 index 0000000000..6b2f3bc1b6 --- /dev/null +++ b/test/functional/legacy/103_visual_mode_reset.lua @@ -0,0 +1,47 @@ +-- Test for visual mode not being reset causing E315 error. + +local helpers = require('test.functional.helpers') +local feed, insert, source = helpers.feed, helpers.insert, helpers.source +local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect + +describe('E315 error', function() + setup(clear) + + it('is working', function() + -- At this point there is no visual selection because :call reset it. + -- Let's restore the selection: + source([[ + let g:msg="Everything's fine." + function! TriggerTheProblem() + normal gv + '<,'>del _ + try + exe "normal \<Esc>" + catch /^Vim\%((\a\+)\)\=:E315/ + echom 'Snap! E315 error!' + let g:msg='Snap! E315 error!' + endtry + endfunction + enew + enew + setl buftype=nofile + call append(line('$'), 'Delete this line.') + ]]) + + -- NOTE: this has to be done by a call to a function because executing + -- :del the ex-way will require the colon operator which resets the + -- visual mode thus preventing the problem: + feed('GV:call TriggerTheProblem()<cr>') + + source([[ + %del _ + call append(line('$'), g:msg) + brewind + ]]) + + -- Assert buffer contents. + expect([[ + + Everything's fine.]]) + end) +end) |