cmdwin_spec.lua (2753B)
1 local n = require('test.functional.testnvim')() 2 local Screen = require('test.functional.ui.screen') 3 4 local clear = n.clear 5 local command = n.command 6 local feed = n.feed 7 8 describe('cmdwin', function() 9 before_each(clear) 10 11 -- oldtest: Test_cmdwin_interrupted() 12 it('still uses a new buffer when interrupting more prompt on open', function() 13 local screen = Screen.new(30, 16) 14 command('set more') 15 command('autocmd WinNew * highlight') 16 feed('q:') 17 screen:expect({ any = vim.pesc('{6:-- More --}^') }) 18 feed('q') 19 screen:expect([[ 20 | 21 {1:~ }|*5 22 {2:[No Name] }| 23 {1::}^ | 24 {1:~ }|*6 25 {3:[Command Line] }| 26 | 27 ]]) 28 feed([[aecho 'done']]) 29 screen:expect([[ 30 | 31 {1:~ }|*5 32 {2:[No Name] }| 33 {1::}echo 'done'^ | 34 {1:~ }|*6 35 {3:[Command Line] }| 36 {5:-- INSERT --} | 37 ]]) 38 feed('<CR>') 39 screen:expect([[ 40 ^ | 41 {1:~ }|*14 42 done | 43 ]]) 44 end) 45 46 -- oldtest: Test_cmdwin_showcmd() 47 it('has correct showcmd', function() 48 local screen = Screen.new(60, 18) 49 command('set showcmd') 50 for _, keys in ipairs({ 'q:', ':<C-F>' }) do 51 feed(keys) 52 local fmt = [[ 53 | 54 {1:~ }|*7 55 {2:[No Name] }| 56 {1::}^ | 57 {1:~ }|*6 58 {3:[Command Line] }| 59 : %s | 60 ]] 61 screen:expect(fmt:format(' ')) 62 feed('"') 63 screen:expect(fmt:format('" ')) 64 feed('x') 65 screen:expect(fmt:format('"x ')) 66 feed('y') 67 screen:expect(fmt:format('"xy ')) 68 feed('y') 69 screen:expect(fmt:format(' ')) 70 feed('<C-C>') 71 n.poke_eventloop() 72 feed('<C-C>') 73 screen:expect([[ 74 ^ | 75 {1:~ }|*16 76 | 77 ]]) 78 end 79 end) 80 end)