global_spec.lua (1617B)
1 local n = require('test.functional.testnvim')() 2 local Screen = require('test.functional.ui.screen') 3 4 local clear = n.clear 5 local exec = n.exec 6 local feed = n.feed 7 local poke_eventloop = n.poke_eventloop 8 9 before_each(clear) 10 11 describe(':global', function() 12 -- oldtest: Test_interrupt_global() 13 it('can be interrupted using Ctrl-C in cmdline mode vim-patch:9.0.0082', function() 14 local screen = Screen.new(75, 6) 15 16 exec([[ 17 set nohlsearch noincsearch 18 cnoremap ; <Cmd>sleep 10<CR> 19 call setline(1, repeat(['foo'], 5)) 20 ]]) 21 22 feed(':g/foo/norm :<C-V>;<CR>') 23 poke_eventloop() -- Wait for :sleep to start 24 feed('<C-C>') 25 screen:expect([[ 26 ^foo | 27 foo |*4 28 {9:Interrupted} | 29 ]]) 30 31 -- Also test in Ex mode 32 feed('gQg/foo/norm :<C-V>;<CR>') 33 poke_eventloop() -- Wait for :sleep to start 34 feed('<C-C>') 35 screen:expect([[ 36 {3: }| 37 Entering Ex mode. Type "visual" to go to Normal mode. | 38 :g/foo/norm :; | 39 | 40 {9:Interrupted} | 41 :^ | 42 ]]) 43 end) 44 end)