normal_spec.lua (968B)
1 local t = require('test.testutil') 2 local n = require('test.functional.testnvim')() 3 4 local clear = n.clear 5 local command = n.command 6 local fn = n.fn 7 local feed = n.feed 8 local expect = n.expect 9 local eq = t.eq 10 local eval = n.eval 11 12 before_each(clear) 13 14 describe(':normal!', function() 15 it('can get out of Insert mode if called from Ex mode #17924', function() 16 feed('gQnormal! Ifoo<CR>') 17 expect('foo') 18 end) 19 20 it('does not execute command in Ex mode when running out of characters', function() 21 command('let g:var = 0') 22 command('normal! gQlet g:var = 1') 23 eq(0, eval('g:var')) 24 end) 25 26 it('gQinsert does not hang #17980', function() 27 command('normal! gQinsert') 28 expect('') 29 end) 30 31 it('can stop Visual mode without closing cmdwin vim-patch:9.0.0234', function() 32 feed('q:') 33 feed('v') 34 eq('v', fn.mode(1)) 35 eq(':', fn.getcmdwintype()) 36 command('normal! \027') 37 eq('n', fn.mode(1)) 38 eq(':', fn.getcmdwintype()) 39 end) 40 end)